Results 1 to 3 of 3

Thread: Proxy API with url parameter substitution?

  1. #1
    Sencha User
    Join Date
    Mar 2010
    Posts
    25
    Vote Rating
    1
      0  

    Default Answered: Proxy API with url parameter substitution?

    My application talks to a very RESTful API, and part of that is that "artifact' updates need to be POSTed to "/artifact/{id}". Is there any way to use this kind of variable substitution in the URL of a Model's proxy API? I didn't see it looking through the docs or source code, so if not, can anyone recommend the best place to plug this in?

    This is basically what I'm trying to get working:

    Code:
    Ext.define('jx.model.Artifact', {
        extend: 'Ext.data.Model',
        requires: [
            'Ext.data.proxy.Ajax',
            'Ext.data.reader.Json'
        ],
        fields: [{
            name: 'id',
            mapping: '_id'
        }, {
            name: 'name',
            mapping: 'name'
        }],
        
        proxy: {
            type: 'ajax',
            reader: {
                type: 'json',
                totalProperty: 'total_rows',
                root: 'rows'
            },
            api: {
                create: 'artifacts',
                read: 'artifacts',
                update: 'artifact/{id}' // <--- HERE
            }
        },

  2. Have you tried using Rest proxy instead of Ajax?

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    Have you tried using Rest proxy instead of Ajax?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Mar 2010
    Posts
    25
    Vote Rating
    1
      0  

    Default

    Well that was obvious! I guess I just didn't see that class in the list. Thank you!

    This is much better than what I started to do, which to create a class named Ext.ux.data.proxy.AjaxWithUrlParameterSubstitution

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •