Results 1 to 6 of 6

Thread: How to override REST endpoints?

  1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    10

    Default How to override REST endpoints?

    Hi,

    I understand that one can override the endpoints for the REST proxy using the `api` configuration property. However, I still have a couple questions. Firstly, is there anyway I can tell ExtJS where to insert variables in those URL's, such as the ID? If I had an endpoint like this for example
    Code:
    /person?id=1
    , how would I tell ExtJS to use that instead of
    Code:
    /person/1
    for example?

    Also, is there anyway to allow say read and update, but not provide any methods for creating or removing records. How do I configure my REST proxy in that scenario?

    Cheers,
    Tom

  2. #2
    Sencha User
    Join Date
    Jan 2013
    Posts
    10

    Default

    I have another question. Some of the things I'll be doing will not match the CRUD model, and so there will be instances where I'll just have to send bespoke requests to the server. Can someone point at the relevant documentation for issuing generic asynchronous requests with Ext JS?

  3. #3
    Sencha User slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,165
    Answers
    505

    Default

    You could extend the Rest proxy and do your own implementation of the buildUrl method which is used to construct the URL used when communicating via the Rest transactions:
    http://docs.sencha.com/extjs/4.2.1/#...ethod-buildUrl

    Instead of setting a URL on the proxy's url config you can specify an api config and set the url for just the read and update actions (though I'd think that ultimately prohibiting destroy and create actions would fall more to UI design):
    http://docs.sencha.com/extjs/4.2.1/#...y.Rest-cfg-api

    For ad hoc transactions you can use Ext.Ajax.request().
    You can pass a config as a param to request() including method which will allow you to specify the verb to use (POST, GET, PUT, etc.)
    http://docs.sencha.com/extjs/4.2.1/#...method-request

  4. #4

  5. #5
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791
    Answers
    585

    Default

    The basics of writing a custom proxy:

    http://skirtlesden.com/articles/custom-proxies

    I'd also advise reading the source code for Rest proxy, there's not a lot to it.

  6. #6
    Sencha Premium User
    Join Date
    Jul 2013
    Posts
    24

    Default

    I'd also advise reading the source code for Rest proxy, there's not a lot to it.
    Where is the source code found?

    I have the commercial SDK and I can not find the source for the REST proxy anywhere.

Posting Permissions

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