Empathy Play API - Pagination
API endpoints that return a list of results use a set of common parameters, return formats and rules for pagination.
Parameters
Name | Optional | Description |
---|---|---|
rows | YES | Number of elements to return. Range must be between 10 and 200. Defaults to 10 Individual services may define different allowed ranges or default value Value will be clamped to the service limits, so the response may not include the requested number of elements |
offset | YES | Offset of the query. Defaults to 0 |
While both parameters are optional, it is recommended to include them.
Return codes
HTTP Code | Description |
---|---|
200 | OK |
400 | rows or offset are not integers |
404 | offset > num_found |
If there are 0 results, a request will offset 0 will return 200 with an empty results list. Any other offset will be a 404.
Result format
The API result will include at least 2 values: the total number of elements and the elements for the current pagination.
Services may include extra fields on the root object.
{ "num_found": N, "results": [...], ... }
Key | Type | Description |
---|---|---|
num_found | integer | Total number of results |
results | array | Actual results. The type of result depends on the API endpoint |