Currently I am using ng-admin to build an admin panel for my webapp.
http://ng-admin-book.marmelab.com/doc/API-mapping.html
This link talks about API mapping and the JSON response expected when ng-admin uses a GET request to get data.
The JSON response format is as follows:
{
"id": 12,
"name": "War and Peace",
"author_id": 345,
"publication_date": "2014-01-01T00:00:00Z",
}
for a book entity defined by name, author_id and publication date.
My REST API returns exactly the same except "_id" instead of "id".
I think this is the reason I can't retrieve data from my API. How can I solve this issue?
Use the entity identifier()
method, as explained in the doc (http://ng-admin-book.marmelab.com/doc/API-mapping.html):
var post = nga.entity('posts')
.identifier(nga.field('_id'));