Pagination
Some resources support GET methods to retrieve a list of resources. The response may be returned in one or more pages depending on the number of objects to be returned. For some resources, you can use the limit and offset parameters to control the response pagination.
Parameters
|
Parameter |
Description |
Default |
|---|---|---|
|
|
A limit on the length of the page. You can set the maximum number of objects to be returned per page between 1 and 1000. |
|
|
|
A cursor for use in pagination. The response will skip the number of matching objects (or rows) specified using the |
|
Response
A paginated response includes the meta property in the JSON-encoded object returned. For a paginated response, the meta property has the following attributes:
|
Property |
Description |
|---|---|
|
|
The number of objects (or rows) per page. |
|
|
The total number of pages in the list. |
|
|
The total number of objects (or rows) in the list. |
|
|
An array of objects containing direct links to other pages and their relation to the page returned:
|
Example
The following example skips the first 90 objects and returns a page of 10 objects starting from the 91th object in the list of results.
GET /rest/v1/receipts?limit=10&offset=90 HTTP/1.1
The response includes the meta attribute with information about the page ( rowsPerPage — the number of objects per page), the list (totalPages and totalRows — the total number of pages and objects in the list, respectively), and direct links to the first, previous, next and last page, as well as the requested page.
{
"message" : "success",
"data" : [
{...}
],
"meta" : { "rowsPerPage": 10,
"totalPages": 85,
"totalRows": 841,
"links": [
{
"rel": "first",
"href": "https://company-id.app.netsuitesuiteprojectspro.com/rest/v1/receipts?limit=10"
},
{
"rel": "prev",
"href": "https://company-id.app.netsuitesuiteprojectspro.com/rest/v1/receipts?limit=10&offset=80"
},
{
"rel": "self",
"href": "https://company-id.app.netsuitesuiteprojectspro.com/rest/v1/receipts?limit=10&offset=90"
},
{
"rel": "next",
"href": "https://company-id.app.netsuitesuiteprojectspro.com/rest/v1/receipts?limit=10&offset=20"
},
{
"rel": "last",
"href": "https://company-id.app.netsuitesuiteprojectspro.com/rest/v1/receipts?limit=10&offset=840"
}
]
}
}