View Full Version : Rest proxy composite keys

10 Oct 2012, 12:36 AM
Do Ext.js proxies support composite keys/ids such as "http..service/api/objects/key1/key2" ? Or is that something that has to be done via a self-composed key?

I'm not an expert, so hints towards more viable paths are highly appreciated.

15 Oct 2012, 5:42 AM
Where would key1 and key2 come from?

15 Oct 2012, 6:21 AM
That would be a 2-dimensional identifier talking to an api. For example key1 would be a document type (to many types to use strongly typed actions) and key2 would be a document in that type collection. So I could compose my own key such as key1 + delimiter + key2, but I'm wondering if I can do that natively with the proxy.
I'm using the rest-proxy and e.g. load() and save() commands of a static model.

Maybe it's just bad coding practice... ?

Thanks! :)

15 Oct 2012, 6:41 AM
Not knowing anything about your app it just seems you are doing too much. REST you can know what action to take depending on the request type (GET, POST, PUT, DELETE). You could also change the URL and the id will be appended to the url.

15 Oct 2012, 6:53 AM
Yes, I have already redesigned how I retrieve the documents from the database to avoid the 2-dimensional keys.
But you are right, I did not think about changing the URL dynamically, e.g. something like this for .NET WebApi: