Results 1 to 2 of 2

Thread: REST Proxy and custom URLs

  1. #1
    Sencha User
    Join Date
    Jul 2017
    Posts
    52
    Answers
    2

    Default REST Proxy and custom URLs

    Trying to use buildURL to customise the url for a REST proxy on a local model. The GET/POST/PUT requests have different urls in my API so when I try to customise the url via buildUrl I get the following error:

    Uncaught Error: Cannot override method buildUrl on Ext.data.proxy.Rest instance.

    However the documentation for the REST proxy says I should be able to override it:

    If further customization is needed, simply implement the buildUrl method and add your custom generated url onto the Ext.data.Request object that is passed to buildUrl. See Rest proxy's implementation for an example of how to achieve this.
    My model is something like this:


    Ext.define('Todo', {
    extend: 'Ext.data.Model',
    proxy: {
    type: 'rest',
    url : URL,
    buildUrl:function(request){
    // THIS IS WHERE I AM TRYING TO CUSTOMISE THE URL
    // TO BE DIFFERENT FOR EACH CRUD REQUEST
    return this.callParent(request);
    }
    });

  2. #2
    Sencha Premium User
    Join Date
    Jun 2011
    Location
    Seattle, WA
    Posts
    33

    Default

    I had to add this other property:

    {
    type: 'rest',

    $configStrict: false, // Required to allow us to overwrite buildUrl in this way

    buildUrl: function (request) {
    ....
    }
    }

Similar Threads

  1. Template like Approach to Rest Proxy API URLs?
    By Trozdol in forum Ext JS 6.x Q&A
    Replies: 1
    Last Post: 27 Dec 2016, 11:55 PM
  2. Rest Proxy custom buildUrl implementation
    By dreebit in forum Sencha Touch 2.x: Q&A
    Replies: 3
    Last Post: 15 May 2014, 11:32 AM
  3. Create Custom request URL with Rest Proxy
    By mirws in forum Ext: Discussion
    Replies: 3
    Last Post: 24 Jan 2013, 2:06 AM
  4. Replies: 2
    Last Post: 5 Sep 2012, 7:29 AM
  5. REST proxy - custom reader?
    By jonmurua in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 12 Mar 2012, 10:14 AM

Posting Permissions

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