View Full Version : How to specify URL parameters in a proxy (4.0.x)?

24 Apr 2013, 10:05 AM
I need to call a service with a URL like /api/component/course/{courseid} where {courseid} is a parameter (part of the URL, not a query string).
How do I define a proxy to produce this URL based on the courseid value I want to send?

25 Apr 2013, 1:11 AM
you can pass courseid from some where when you create the store, and use in your url like:

url: '/api/component/course/' + config.courseid

25 Apr 2013, 2:02 PM
I have a store with the following code:

proxy: {
type: 'ajax',
actionMethods : {
read: "GET",
update: "PUT"
reader: {
type: 'json'
writer: {
type: 'json'

constructor: function (config) {
var me = this;
me.proxy.api = {
create: '/api/component/course',
read : '/api/component/course',
update : '/api/component/course'

The update url needs to have an id in the url. How would I specify that? And are you suggesting I need to create a new store for each course id? I'd rather be able to re-use the same store and read/write the data as needed. I'm using the MVC pattern as well.

25 Apr 2013, 5:31 PM
in this case, maybe you can do this in your update function

Ext.Ajax.request({ url: '/api/component/course/' + id,
params: {id: id},
method: 'PUT',
success: function(response){....}
failure: function(response){....}

25 Apr 2013, 9:15 PM
If you need to modify the proxy's url instead of modifying the params sent you might make use of the buildUrl() method.