New HTTP headers will be added shortly to the API

97 views
Skip to first unread message

Emanuil Tolev

unread,
Mar 11, 2016, 4:11:59 AM3/11/16
to doaj-api-announcements
HTTP headers of the following form will be added to all Discovery API responses from early next week:

1. Link headers for navigating the paged results:

Link: <https://doaj.org/api/v1/search/articles/%2A?page=1&pageSize=10>; rel=prev, <https://doaj.org/api/v1/search/articles/%2A?page=5&pageSize=10>; rel=last, <https://doaj.org/api/v1/search/articles/%2A?page=3&pageSize=10>; rel=next

Feel free to use these to "scroll" through results instead of having to generate the correct URLs. Hopefully this will make API clients a bit simpler to write and maintain. There are various tools depending on your programming language of choice which will make it very easy to use these. Here's an example of a popular Python HTTP client library's handling of these headers: http://docs.python-requests.org/en/master/user/advanced/#link-headers .

2. Total results count:

X-Total-Count: 153

We have gone for an API with an envelope (metadata + results contained in the body of the response). Thus, you already have access to this information in the "total" key in the Discovery API responses. However, this header is used by a number of other API-s, so we're providing it for convenience and for those who are used to having it.

Let us know at https://groups.google.com/forum/#!forum/doaj-public-api if this causes any problems for you. We don't expect that to be the case, hence the short notice on releasing this feature.

Regards,
Cottage Labs on behalf of DOAJ
Reply all
Reply to author
Forward
0 new messages