Guidance on Responses
Pagination
Any requests which return a list of objects follow the same pattern in terms of the request parameters as well as response structure.
Request
When building the request, you can specify the following parameters to control the number and set and results:
limit
- the maximum number of objects to return from the queryoffset
- the offset to begin retrieve from
For example in the GET
API request,
- if consumer pass limit=20 and offset=40, then it would return up to 20 results, skipping the first 40 that match
- if consumer NOT pass anything in limit and offset, then it would return up to 20 results as default, with the first 20 that match
- if consumer pass limit=100 and offset=0, then it would return up to 100 results, with the first 100 that match
- if consumer pass limit=100 and offset=200, then it would return up to 100 results, skipping the first 200 that match
Note: The maximum allowed value in limit is 100.
Response
List responses are made up of an array of all data items returned for a given 'page' of results as per the limit and offset provided in the GET
API request.
In order to help consumer know how and when to paginate further, our APIs include following field in API response header:
"hasMoreRecords": true
- hasMoreRecords - whether or not there is another 'page' of results after the current one, if this is false, the consumer can be confident they can stop paginating further.
Individual API call required to retireve each page of the data from the overall matched records.
-
On the first API call, if consumer passed offset=0 & limit=100, then it results first 100 records in API response along with header as below.
"hasMoreRecords": true
-
Then on the second API call, consumer should pass offset=100 & limit=100, then it results second 100 records in API response along with header as below.
"hasMoreRecords": true
-
On the third API call, consumer should pass offset=200 & limit=100, then it results third 100 records in API response along with meta data as header as below. When 'hasMoreRecords' is false, then the consumer can be confident they can stop paginating further.
"hasMoreRecords": false
See the specific API reference for more detail on which of those are used.
Updated about 4 hours ago