-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify use of X-Total-Count #116
Comments
I think you are right here. When we deprecated links in headers, we should have also deprecated this total count in headers. Of course, when deciding whether to include such a total count at all in your API design, you should consider the performance implications (i.e. your database might need to have a look at all candidate items in order to count them, depending on filter criteria) and whether this information is actually needed. |
Absolutely agree; I've seen this a number of times :) Perhaps it could be added as an aside to the guidelines. |
During the API Guild meeting we agreed this is a good idea. |
This makes the X-Total-Count header optional and not preferred over count data in a JSON result, along with guidance on when the header can be useful. For zalando#116
This makes the X-Total-Count header optional and not preferred over count data in a JSON result, along with guidance on when the header can be useful. For zalando#116
This makes the X-Total-Count header optional and not preferred over count data in a JSON result, along with guidance on when the header can be useful. For zalando#116
This makes the X-Total-Count header optional and not preferred over count data in a JSON result, along with guidance on when the header can be useful. For zalando#116
* Updating isort call to check if the repo is using isort v4 or sort v5 + * Updating isort reqs to 5.8.0 * Isort and black formatting changes Co-authored-by: Jason Weir <91488+Gidgidonihah@users.noreply.github.com>
In "Could: Use Pagination Links Where Applicable",
X-Total-Count
is mentioned as an option for describing result count.In JSON (which is the required media type), it's not necessary to ask clients to look in a header when a total count field can be added to the result entity, simplifying client access. The guidelines could be interpreted as saying when you serve pagination links, you are to use
X-Total-Count
in conjunction with paging links. It would be good to edit the example to include a total count in the data, and makingX-Total-Count
entirely optional. A final thought I guess is that we should consider avoiding custom headers to work with APIs unless they're strictly needed.X-Total-Count
seems to make most sense in these cases:The first two are not directly applicable (Link was removed a while back, we require JSON). The last one is (imho) something we shouldn't encourage because arrays don't afford extensibility the way object based collections/results can (eg you can't easily include pagination links with an array result in the example).
The text was updated successfully, but these errors were encountered: