Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Documentation is weak for Request and Rest Stores #192

Closed
cgaeking opened this issue Aug 3, 2016 · 0 comments · Fixed by #235
Closed

Documentation is weak for Request and Rest Stores #192

cgaeking opened this issue Aug 3, 2016 · 0 comments · Fixed by #235

Comments

@cgaeking
Copy link

cgaeking commented Aug 3, 2016

Design of JSON-Responses for Request and Rest Stores

It took me quite some time to research until I finally figured out, that the OnDemandGrid /-List does not work with Request or Rest Stores if the response doesn't include the total amount of results.

There are actually 2 different supported formats of json responses that are supported.
Please, include this in your documentation.

First way:

Include a header in the response like:
Content-Range:items 0-24/500

Data:

[{"id":0,"name":"Item 0","comment":"hello"},{"id":1,"name":"Item 1","comment":"hello"},
{"id":2,"name":"Item 2","comment":"hello"},{"id":3,"name":"Item 3","comment":"hello"},
{"id":4,"name":"Item 4","comment":"hello"},{"id":5,"name":"Item 5","comment":"hello"},...]

Second way:

Include a total field in the json:

{
  "total":500,
  "items":
     [{"id":0,"name":"Item 0","comment":"hello"},
      {"id":1,"name":"Item 1","comment":"hello"},
      {"id":2,"name":"Item 2","comment":"hello"},
     {"id":3,"name":"Item 3","comment":"hello"},...
     ]
}
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant