Building complex REST url

You can add custom methods in the same one adapter.

App.ProductAdapter = DS.RESTAdapter.extend({
    someCustomMethod: function(customData) {
        // Here you can handle custom data, and after that send POST request
        return this.ajax('/ajax.php', 'POST', { data: customData });
    }
});

… usage

var customAdapter = this.container.lookup('adapter:product');
var data = {
    username: "michael",
    password: "123456",
    clientID: "2",
    productID: 201
};
customAdapter.someCustomMethod(data).then(function(response) {
    // response handler
}, function(e) {
   // error handler
});

But I’m not sure that it’s exactly what your need. And are you really use Ember Data or not?

2 Likes