PDA

View Full Version : doubt about rest url



fabioebner
11 Nov 2013, 4:41 AM
anyone know if sencha can work with the rest url just like backbone? example:


http://mysite.com/user/123 // get the user 123


http://mysite.com/user/123/son/1 // get the son 1 from user 123


http://mysite.com/user/123/son/2 // get the son 2 from user 123


so far I only managed to use http://mysite.com/user?cd=123&son=3


tks

Gary Schlosberg
11 Nov 2013, 9:07 AM
Have a look at this doc page:
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.proxy.Rest

fabioebner
11 Nov 2013, 10:17 AM
i already have looked. but at the doc he only have example to first level from url

http://mysite.com/user/123 // get the user 123

don't have the others level.:

http://mysite.com/user/123/son/1 // get the son 1 from user 123
http://mysite.com/user/123/son/2 // get the son 2 from user 123

and in my tests i can't do this

existdissolve
11 Nov 2013, 5:47 PM
i already have looked. but at the doc he only have example to first level from url

http://mysite.com/user/123 // get the user 123

don't have the others level.:

http://mysite.com/user/123/son/1 // get the son 1 from user 123
http://mysite.com/user/123/son/2 // get the son 2 from user 123

and in my tests i can't do this

The default format that the Rest proxy will use is that which Gary linked to. You can, of course, create your own proxy which extends the Rest proxy and overrides the buildUrl (http://docs.sencha.com/extjs/4.2.1/source/Rest.html#Ext-data-proxy-Rest-method-buildUrl) method. In this method, you can implement whatever logic you'd like to create any format of URL that you need.

skirtle
11 Nov 2013, 6:00 PM
Have a read of the source code for the Rest proxy. There's only a handful of lines, it's dead easy to understand.

For more on writing a custom proxy see:

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