Paging (Limit/Offset)
To page your result set, you can specify limit=...
and offset=...
.
offset=
determines how far into the records you are querying
for to start returning data. For example, if you are querying for customers
and you have ten customers ranging from customer_id=1
and
customer_id=10
and offset=0
, then the returned
set of customers will start with the customer whose customer_id=1
.
However, if the offset=3
then the list of customers that is
returned will start with the customer who has a customer_id=4
.
limit=
determines the number of records returned. For example if
limit=5
when querying for customers, you would get back the data for
no more than five customers.
If your query contains ?offset=10&limit=15
, then this is essentially
saying, "starting at record 10, fetch the next 15 records."
Make note of the maximum number of records you can retrieve per page!
- If not specified otherwise, your result set will page by default at 10 records.
- The maximum number of records you can return per page is 500. You will not be able to retrieve more than 500 records at one time.
GET /api/v3/user?offset=8&limit=2
HTTP/1.1 200 OK
Content-Type: application/json
{
"code": 200,
"status": "OK",
"message": "",
"details": {},
"response": [
{
"user_id": 356,
"external_key": null,
"first_name": "John",
"middle_name_glob": null,
"last_name": "Doe",
// ...other user data...
},
{
"user_id": 357,
"external_key": null,
"first_name": "Jane",
"middle_name_glob": null,
"last_name": "Doe",
// ...other user data...
}
]
}