Reputation: 870
I created a new RestAdapter like so.
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
namespace: 'api',
host: 'http://localhost:8081'
});
if i look at the network calls the api gets called properly and returns this data.
{
"environments": [
{
"Id": 1,
"LocalePath": "C:\\XML_DEPOT",
"Name": "Acceptation 1",
"RemotePath": "D:\\XML_DEPOT",
"DatabaseServerName": "somedata",
"DatabaseName": "somedata",
"Port": 60903
},
{
"Id": 2,
"LocalePath": "bob",
"Name": "Acceptation 2",
"RemotePath": "bob",
"DatabaseServerName": "somedata\\somedata",
"DatabaseName": "somedata",
"Port": 60904
}
]
}
and then i get an error saying that
Assertion Failed: normalizeResponse must return a valid JSON API document
but from what i understand the adapter is not a JSONAPIAdapter so it shouldnt try to serialize it has a jsonapi ??
Upvotes: 0
Views: 44
Reputation: 6338
Ember Data is using JSON Api spec internally since version 1.13 as described in release notes. normalizeResponse
method of DS.RestAdapter "is used to normalize a payload from the server to a JSON-API Document."
Your payload does not look like what ember data RestAdapater excepts as default. RestAdapter expects camelCase keys but yours are CamelCase. You have to customize your serializer keyForAttribute
method to get it working.
Upvotes: 1