View Full Version : Proxy API with url parameter substitution?

12 Mar 2012, 10:18 AM
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:

Ext.define('jx.model.Artifact', {
extend: 'Ext.data.Model',
requires: [
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

12 Mar 2012, 10:25 AM
Have you tried using Rest proxy instead of Ajax?

12 Mar 2012, 10:36 AM
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 :)