Pagination & filtering
Learn how to paginate and filter your requests
Some of the resources in the maesn API support pagination and filtering.
Pagination
Pagination is done through the query parameters limit
and page
. The limit
parameter specifies the number of resources to return per page, while the page
parameter specifies the page number to return.
The page
parameter starts at 1.
The limit
parameter can be the following values: 5, 10, 20, 50, 100
const response = await axios.get(url, {
params: {
"limit": limit,
"page": page
},
headers: {
'X-API-KEY': apiKey,
'X-ACCOUNT-KEY': accountKey
}
});
Filtering
Filtering of API responses is done through query parameters. The parameters supported by the respective endpoint is documented in the API reference.
As an example, when fetching invoices you can filter on invoices modified since a given date and time by supplying the parameter lastModified
. Thus, as an example, passinglastModified=2021-03-30T20:44:18
to GET /invoices would return all invoices modified 30th March 2021 at 20:44:18 or later.
const response = await axios.get(url, {
params: {
"lastModified": lastModified
},
headers: {
'X-API-KEY': apiKey,
'X-ACCOUNT-KEY': accountKey
}
});
The query parameter ‘status’ is currently in beta-testing and is available for invoices for Xentral and Sage Active.
const response = await axios.get(url, {
params: {
"status": status
},
headers: {
'X-API-KEY': apiKey,
'X-ACCOUNT-KEY': accountKey
}
});
Was this page helpful?