Revnue GET
requests returns 25 results by default and requires pagination passed as a request parameter when retrieving data exceeding page 1.
In the GET
request below, the pagination request parameter is not defined and the first 25 results will be returned by default (ordered by id
ascending).
curl --request GET \
--url 'https://{{base_url}}/api/v2/category/?company=1' \
--header 'Authorization: Bearer $BEARER_TOKEN'
In the GET
request below, we pass the parameter page
designating the page number. In this case page=3
would return the 3rd page of pagination. In addition, the response also returns count
for total number of records for the request along with next
and previous
for URLs to request records on the next or previous page, if applicable.
curl --request GET \
--url 'https://{{base_url}}/api/v2/category/?company=1&page=3' \
--header 'Authorization: Bearer $BEARER_TOKEN'
And here is what the example response will look like. Notice null
is returned as the next page since there are no more results past this page.
{
"count": 51,
"next": "null",
"previous": "https://{{base_url}}/api/v2/category/?company=1&page=2",
"results": [
{
"id": 51,
"category": "Search Deliverables",
"subcategories": null
}
]
}