Pagination & Sorting
Request
All API endpoints returning a list of results (e.g. Object Types, Objects, Warrants, and Query) support cursor-based pagination via a combination of the limit
, prevCursor
, and nextCursor
query parameters. They also support sorting via the sortBy
and sortOrder
query parameters:
Query Params
limit number
A positive integer representing the maximum number of items to return in the response. Must be less than or equal to 1000
. Defaults to 25
.
prevCursor string
A cursor representing your place in a list of results. Requests containing prevCursor
will return the results immediately preceding the cursor.
nextCursor string
A cursor representing your place in a list of results. Requests containing nextCursor
will return the results immediately following the cursor.
sortBy string
The column to sort the result by. Unless otherwise specified, all list endpoints are sorted by their unique identifier by default.
sortOrder string
The order in which to sort the result by. Valid values are ASC
and DESC
. Defaults to ASC
.
- cURL
- Go
- Java
- Node.js
- Python
- Ruby
curl "https://api.warrant.dev/v2/objects?objectType=user&sortBy=objectId&sortOrder=DESC&nextCursor=eyJpZCI6ImRvY3VtZW50OkQzIn0=&limit=2" \
-H "Authorization: ApiKey YOUR_KEY"
const warrants = await warrantClient.Warrant.List({
limit: 25,
sortOrder: "DESC",
nextCursor: "eyJpZCI6ImRvY3VtZW50OkQzIn0"
});
Response
All API endpoints returning a list of results will include: the result set in the results
field, a cursor to the previous set of results prevCursor
(if applicable), and a cursor to the next set of results nextCursor
(if applicable).
Body
results array
The list of requested resources.
prevCursor string
The cursor value to use to request the list of results immediately preceding this result set. This field will be omitted if there are no prior results to fetch.
nextCursor string
The cursor value to use to request the list of results immediately following this result set. This field will be omitted if there are no more results to fetch.
{
"results": [
{
"objectType": "user",
"objectId": "userXYZ",
"meta": {
"email": "emailB@warrant.dev"
}
},
{
"objectType": "user",
"objectId": "userABC",
"meta": {
"email": "emailC@warrant.dev"
}
}
],
"prevCursor": "eyJpZCI6IjY2YmMxMWEwLWVjYjktNDExMC1iNDI3LTIzZWRhMjBkODNkZCIsInZhbHVlIjoiMjAyMy0xMC0xN1QyMTo0NDoxNy4wNTM1NTJaIn0=",
"nextCursor": "eyJpZCI6ImRvY3VtZW50OkYzIiwidmFsdWUiOiIyMDIzLTEwLTE3VDIxOjQ0OjE2Ljc4OTc5OVoifQ=="
}