Responses
Success
API Response Success Schema and Details. Status codes, pagination, and SDK integration examples
Status Codes and Description
Here are all the responses success status codes and their description
| Status Code | Description | Possible Response Schema | Body |
|---|---|---|---|
200OK |
When retrieving a resource | ResponseOk / ResponseWithPagination | Resource / Resources and pagination |
201 Created |
When creating a new resource | ResponseOk | Resource created |
204 No Content |
Updating or deleting a resource | ResponseNoContent | None |
Response Ok Schema
Data contains the response object
Status indicates the response status "success" Examples: "success"
{
"data": "<any>",
"status": "success"
}
Response With Pagination Schema
The following resources will return a paginated response when requesting a list : job, source, file, notification, upload.
When requesting a list of these resources, the default and max limit is 100. So by default if there is more than 100 items that responds to your request you will need to use pagination to get through all of them.
Data contains the paginated items
Limit indicates the maximum number of items in the current response
Offset indicates the offset of the first item in the current response
Total indicates the total number of items
Status indicates the response status "success" Examples: "success"
{
"data": "<any>",
"limit": 20,
"offset": 0,
"status": "success",
"total": 154
}
Pagination use with our SDK
Some quick examples on how to use pagination with our SDK:
import { createClient } from 'chunkify';
const client = createClient({
projectToken: 'your_token',
});
// List all the sources with limit 10
const paginatedResults = await client.source.list({
limit: 10,
});
// You can access the first page of result
console.log(paginatedResults.items);
// Or Iterate over the paginated results
for await (const page of paginatedResults) {
// Access the current page of sources
page.items.forEach((source) => {
console.log(source.id, source.url);
});
}