The mabl API uses cursor-based pagination for endpoints that retrieve a list of results, such as query users, get batch test run results, and query DataTables.
These methods support two query parameters for pagination:
limit
- define the maximum number of results returned in a single response. Defaults vary by endpoint.cursor
- after the first request, use the returned cursor value from the response of the previous call to get the next page of results.
For example, to retrieve up to 20 DataTables in a workspace, add limit=20
as a query parameter:
https://api.mabl.com/dataTables?workspace_id={workspace_id}&limit=20
The response includes the cursor
value to retrieve the next page of results:
{
"dataTables": [...],
"cursor": "cursor_value"
}
The value cursor_value
is a placeholder value that represents the cursor
. Using the endpoint from the previous example, make a request to the following URL to retrieve the next page of results:
https://api.mabl.com/dataTables?workspace_id={workspace_id}&limit=20&cursor={cursor_value}
When the returned cursor is the same as the cursor passed in the request, all results have been retrieved.*
*The endpoint to get test run summaries over time is an exception. For this endpoint, all results have been retrieved when the cursor returns undefined
or null
.