-
12 Mar 2012 10:18 AM #1
Answered: Proxy API with url parameter substitution?
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 } },
-
Best Answer Posted by mitchellsimoens
Have you tried using Rest proxy instead of Ajax?
-
12 Mar 2012 10:25 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,641
- Vote Rating
- 434
- Answers
- 3107
Have you tried using Rest proxy instead of Ajax?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
12 Mar 2012 10:36 AM #3
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


Reply With Quote