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 { initSalable } from '@salable/node-sdk';
const salable = initSalable('your-salable-api-key', 'v3');
await salable.subscriptions.getAll({
owner: 'owner-id',
cursor: 'ID-20'
});
const params = new URLSearchParams();
params.append("owner", "owner-id");
params.append("cursor", "ID-1");
const response = await fetch(`https://api.salable.app/subscriptions?${params}`, {
headers: {
"x-api-key": "your-salable-api-key",
version: "v3"
}
});
const subscriptions = await response.json();
curl
-XPOST
-H 'x-api-key: your-salable-api-key'
-H 'version: v3'
'https://api.salable.app/subscriptions?owner=owner-id&cursor=ID-20'
Option | Description | Required |
---|---|---|
take | Number of items returned per request. Default 20 . If you provide a negative number with a cursor, all objects will be fetched that are before the cursor instead of after. | ❌ |
cursor | The ID of the item to take from in the list. If not set the request will return the first page. | ❌ |