Pagination & Sorting

Pagination

For each route in the API, pagination has been enabled as standard for both the index and advanced search methods, where potentially hundreds or thousands of results could be returned. Pagination is controlled by the url query parameters.

The limit query parameter is set as 20 results per db query as default unless specified (a maximim of 200 results will be returned for any one request).
The skip query parameter is set as 0 by default unless specified.
The skip query parameter allows pagination by returning limit multiplied by page number.

For example, to request the third page of results for conditions for a limit it 25 results per page, the following query would apply: GET /api/conditions?limit=25&skip=75

Sorting

Results can be sorted by providing an sort query parameter. e.g. to sort the previous query by organ append the following: ‘&sort=organ’

The default sort criteria is ascending, however, a descending criteria can be provided by appending a criteria query parameter e.g. ‘&criteria=descending’

These methods can also allow infinite scrolling.