-
Notifications
You must be signed in to change notification settings - Fork 0
API Paging
mark-bell-tna edited this page May 17, 2023
·
2 revisions
The search API takes two parameters:
- search term (mandatory)
- page number (optional, defaults to 1) [Variable = Current Page]
Current Page must not be below 1 If Current Page is less than 1 an error will be raised
The number of pages [Variable = Number of Pages] returned is calculated by dividing the total number of rows returned by the query by the number of records per page [TODO: where is this set?] and rounding up to the nearest integer value greater than zero. If no data is returned by the query an empty array of data is returned If Current Page is greater than the last page of data an empty array of data is returned
The API returns URLs for first, previous, next, and last pages.
The URLs consist of the original search parameter and the page number parameter which is derived as follows:
- First: always 1
- Previous: greater of 1 and Current Page-1
- Next: lesser of Number of Pages and Current Page+1
- Last: Number of Pages
Test | Response |
---|---|
No search term | Error |
No page number | Page 1 returned |
Search term not in database | Return empty list, page 1 |
Page number below 1 | Error |