Pagination
All endpoints that use pagination are cursor based. You can use the ID of the last
value in the response as the cursor
for the next request. The item used as the cursor
will not be included in the response.
Example response
{
"first": "ID-1",
"last": "ID-20",
"data": [
//...
]
}
Example request with cursor
- Node SDK
- Fetch
- cURL
import { Salable } from '@salable/node-sdk';
const salable = new Salable('your-salable-api-key', 'v2');
await salable.subscriptions.getAll({
owner: 'orgId_1',
cursor: 'ID-20'
});
const params = new URLSearchParams();
params.append("owner", "orgId_1");
params.append("cursor", "ID-1");
const response = await fetch(`https://api.salable.app/subscriptions?${params}`, {
headers: {
"x-api-key": "your-salable-api-key",
version: "v2"
}
});
const subscriptions = await response.json();
curl
-XPOST
-H 'x-api-key: your-salable-api-key'
-H 'version: v2'
'https://api.salable.app/subscriptions?owner=orgId_1&cursor=ID-20'
Option | Description | Required |
---|---|---|
take | Number of items returned per request. Default 20 . | ❌ |
cursor | The ID of the item to take from in the list. If not set the request will return the first page. | ❌ |