Ember Data RESTAdapter: are matrix parameters possible?


Hello everybody!

From my Ember application I have to call some REST API which supports only matrix parameters in URL (separated by ‘;’) and does not support more classic query parameters (separated by ‘?’ and ‘&’).

I use Ember Data 1.0.0-beta.15.

By default, when I call store.find(), a request URL is built using query parameters. Are there any configuration ways to instruct RESTAdapter (I believe this is the component to configure in my case) to apply matrix parameters?

Thank you! Andre




Finally my decision was to override the findQuery() method as following:

export default DS.RESTAdapter.extend({

  findQuery: function(store, type, query) {
    if (query.matrix) {
      var url = this.buildURL(type.typeKey);

      Object.keys(query).forEach(function(queryParamName) {
        if (queryParamName.toString() !== 'matrix') {
          url += ';' + queryParamName + '=' + query[queryParamName];

      return this.ajax(url, 'GET', { data: {} }); //originally was '{ data: query }'
    } else {
      return this._super(store, type, query);

I introduced a dedicated ‘matrix’ query parameter which is optional, can be set by a route and which indicates that a URL with matrix params is required. As you see above the ‘matrix’ query parameter is intercepted by the findQuery() method and does not go to a server.