Pagination

In this guide, we will look at how to work with paginated responses when querying the Babele API. All API endpoints that return paginated data require the pagination to be set

Pagination data is sent in the request body as a JSON object, using 2 properties: take and skip. The take property specifies the number of items to return, while the skip property specifies the number of items to skip before starting to return items. For example, if you set take to 10 and skip to 5, the API will return items 6 through 15.

Every paginated response will have a count property which indicates the total number of items available. This is useful for determining how many pages of data are available and for implementing pagination in your client.

Example

In this example, we request the first 50 items from the applications endpoint, skipping the first 50 items. The API will return the next 50 items after the first 50.

Manual pagination using cURL


curl -X POST https://api.babele.co/api/ApplicationDefinition/999/Applications \
-H "Authorization: Bearer eyJhbGcgwgwe7gfwgwZZVCJ9.eyJTdWJqZWN0IjoiN2ZkMjc4YmUtMzA1Zi00ZWExLWJmODItNTQ5Yjg0NDBiM2E5IiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvc2lkIjoiYjE5ZDE0NWYtZDZiZC00Y2U5LTljYTQtYjFlOTgzNmRhODlhIiwidXBuIjoiNDAxMTQ0IiwiaHR0cDovL2JhYmVsZS5jby9jbGFpbXMvcGxhdGZvcm1hZG1pbmNsYWltIjoiRmFsc2UiLCJodHRwOi8vYmFiZWxlLmNvL2NsYWltcy9sb2dpbnJlcXFWFWGFQFsc2UiLCJuYmYiOjE3NDMyNjA0MDcsImV4cCI6MTc0Mzg2NTIwNywiaWF0IjoxNzQzMjYwNDA3fQ.K34301vGXSvFQC-5ypvDbfEr-L-uX57zw6GBjNa3sT4" \
-H "Content-Type: application/json" \
-d '{"skip":50,"take":50,"orderBy":0}'

Paginated response

{
"applicationDefinitionFilters": {
    "applicationTags": null,
    "applicationCountries": null,
    "applicationStages": null,
    "applicationIndustries": null,
    "applicationSDGs": null,
    "applicationUserInterests": null
},
"count": 200,
"list": [
    {
        "id": 1334,
        "applicationDefinitionName": "Venture",
        .
        .
        .
    },
    {
        "id": 1333,
        "applicationDefinitionName": "Venture",
        .
        .
        .
    }
],
"filters": null
}