dimanche 9 août 2015

How is a json paginated resource supposed to look like?

With Ember Data and Jsonapi. How is a json paginated resource supposed to look like?

I built my response so it looks like:

"meta": {
  "page": {
    "number": 1,
    "size": 5,
    "total": 39
  }
},
"links": {
  "self": "http://localhost:3099/api/v1/articles",
  "prev": null,
  "next": "http://localhost:3099/api/v1/articles?page[number]=2",
  "first": "http://localhost:3099/api/v1/articles?page[number]=1",
  "last": "http://localhost:3099/api/v1/articles?page[number]=39"
},
"data": [
  ...
]

But I am not exactly sure if this is the right format. based on the explanation at http://ift.tt/1ISH8KN

Or, are the pagination links (i.e. prev, next, first and last) supposed to be in meta.page ?




Aucun commentaire:

Enregistrer un commentaire