How to pass an api key as part of url in my ember app


#1

I have an ember app that is consuming an API. My API requires an API key be sent in the URL like…

/api/v1/shots?api_key=d26da3938adc5f3c8604256194c18501

Here is the ember code I’m trying to get to work…

App.Person = Ember.Model.extend({ name: Ember.attr() });

App.Person.adapter = Ember.RESTAdapter.create(); App.Person.url = “http://myJunk.com/api/v1/shots?api_key=d26da3938adc5f3c8604256194c18501”; App.Person.collectionKey = “shots”;

The issue I’m having is that ‘.json’ is being appended to the URL. Here is the error I get in chrome…

XMLHttpRequest cannot load http://myJunk.com/api/v1/shots?api_key=d26da3938adc5f3c8604256194c18501.json.

Looks like this is a know issue based on…

…/ebryn/ember-model/issues/300

However, I am using the 1.5 which is what is on…

…/emberjs/starter-kit

What is the right way to do this in ember?


#2

Looks like this fix has not made it to release yet. See Erik’s comment here…