Content type
The JRNI API uses the JSON format. Use
application/json
for the Content-Type
header in POST and PUT requests. Use
application/json
in the Accept
header of requests.
HAL
The JRNI API is a hypermedia REST API. By including links in the API response, clients can discover related resources. More information can be found on this REST API Tutorial or in a good book on REST.
Hypertext Application Language (HAL) is used as the default format for the responses. It’s a relatively simple format but allows us to benefit from hyperlinks without too much overhead. While the links in the responses can be ignored it’s advisable to use them in your projects to help decouple the implementation from some of the specifics of the API.
Pagination
Most of the JRNI API endpoints that return collections have parameters that
enable control of the pagination of the response. The per_page
param sets the
number of items that will be returned while the page
param enables skipping
to a particular set of results. There will be next
and back
links in the
response to indicate how the paged results can be navigated. There is also a
total_entries
attribute so that the total number of items can be established
without paging through all the results.