Pagination

Introduction

Pagination in fulfillmenttools enables efficient handling of large data sets when searching for entities such as stocks. Instead of returning all results in a single response, the system divides them into smaller, manageable pages. Each search response includes a pageInfo object with cursors and flags (for example, hasNextPage and endCursor) that indicate whether additional results are available. These values can be applied to request subsequent pages until all records are retrieved.

Iterating over multiple pages

When reading a number of entities that do not fit one page, It is necessary to iterate over multiple pages of search results to collect all required information. An example is iterating over pages to get the Id and version of all entities for an update.

Search entities with pagination

The search endpoints return paginated responses. Each response includes a pageInfo object that indicates whether additional pages are available.

Example request for stock

POST https://{YOUR_TENANT_NAME}.api.fulfillmenttools.com/api/stocks/search
{
  "query": {
    "tenantArticleId": {
      "eq": "4711"
    }
  }
}

Example response for stock

{
    "total": 28,
    "pageInfo": {
        "hasNextPage": true,
        "hasPreviousPage": false,
        "startCursor": "MDBhZjE1NzEtMjg5MC00ZTE0LTg1OTEtOWVjZjEyODYzMjIw",
        "endCursor": "YjljYTkwZDMtYWEyMC00MmIyLTlmMmItMDk5ZTIxNWFhZGU0"
    },
    "stocks": [
        {
            "created": "2025-11-06T13:11:35.738Z",
            "facilityRef": "d083f631-9f4c-463b-85d4-9414fb19239f",
            "id": "00af1571-2890-4e14-8591-9ecf12863220",
            "lastModified": "2025-11-26T07:54:35.624Z",
            "tenantArticleId": "4711",
            "value": 100,
            "locationRef": "SL-02",
            "scannableCodes": [],
            "scores": [...],
            "tenantStockId": null,
            "reserved": 0,
            "facilityWideReserved": 0,
            "available": 111,
            "traits": [
                "PICKABLE",
                "ACCESSIBLE"
            ],
            "traitConfig": null,
            "conditions": null,
            "properties": {},
            "serializedProperties": "{}",
            "receiptDate": "2025-11-16T07:46:16.215Z",
            "version": 2,
            "customAttributes": null,
            "availableUntil": null,
            "reservations": [],
            "combinedId": "d083f631-9f4c-463b-85d4-9414fb19239f_11111",
            "facility": {
                "facilityRef": "d083f631-9f4c-463b-85d4-9414fb19239f"
            }
        },
        {
            "created": "2025-11-10T13:19:15.624Z",
            "facilityRef": "d083f631-9f4c-463b-85d4-9414fb19239f",
            "id": "019a6deb-b698-7510-b7a2-ee891d09b1a7",
            "lastModified": "2025-11-10T13:19:15.624Z",
            "tenantArticleId": "4711",
            "value": 10,
            "locationRef": "SL-01",
            "scannableCodes": [],
            "scores": [...],
            "tenantStockId": null,
            "reserved": 0,
            "facilityWideReserved": 0,
            "available": 10,
            "traits": [
                "PICKABLE",
                "ACCESSIBLE"
            ],
            "traitConfig": null,
            "conditions": null,
            "properties": {},
            "serializedProperties": "{}",
            "receiptDate": "2023-06-16T07:42:54.646Z",
            "version": 1,
            "customAttributes": null,
            "availableUntil": null,
            "reservations": [],
            "combinedId": "d083f631-9f4c-463b-85d4-9414fb19239f_11111",
            "facility": {
                "facilityRef": "d083f631-9f4c-463b-85d4-9414fb19239f"
            }
        },
        ...
    ]
}
  • The entity array (in this example, stocks) contains the records, including id and version.

  • The pageInfo object provides cursors and flags (hasNextPage, hasPreviousPage) to navigate through results.

Page iteration

To retrieve all entities, iterate through the pages until hasNextPage is false.

Example workflow

  1. Send the initial search request.

  2. Collect the id and version values from the entity array.

  3. Check the pageInfo.hasNextPage flag.

    • If true, send another request using the endCursor value as the starting point for the next page.

    • If false, all results have been retrieved.

Last updated