I have managed to work with REST API\'s to fetch()
data where the urls contain minimal parameters (and use GET
).
How would one retrieve a c
You may need to extend the Collection object to install your own convention for fetches. In doing so, you would likely provide your own fetch function. Something like:
fetch : function(options) {
options || (options = {});
var model = this;
var success = function(resp) {
if (!model.set(model.parse(resp), options)) return false;
if (options.success) options.success(model, resp);
};
var error = wrapError(options.error, model, options);
(this.sync || Backbone.sync)('create', this, success, error);
return this;
}
where it uses a 'create' instead of a 'read'. On first blush, this is what I'd try first, though there may be a more elegant way to do it.
The downside of this approach is that you essentially have framework code in your app and if the framework changes you might encounter problems. You would do well to compartmentalize this change into a separate layer to make it easy to update with new framework releases.