Pagination

Break up one lengthy response into several smaller responses.

Overview

Pagination is used to conveniently limit the number of objects returned at once by a query. If 10,000 objects are to be returned by a query, 1000 objects will be returned at a time. The number of returned objects can be reduced, however, by adding the pageSize parameter to the query.

Details

The value of pageSize is the number of objects that will be returned per query. Along with the objects from each query, a continuation token will also be received. This token can be added as a parameter (continuationToken) to the query in order to receive the next batch of objects. Once all of the objects have been received, another continuation token will not be sent. Pagination is available for the ecosystem, environment, device, zone, and user endpoints.

Example

Sample Environment

Sample device D573bc694ae9ac9419f028b61 with alias stereo:

{
    "id": "D573bc694ae9ac9419f028b61",
    "ecosystemId": "C573b86eeee43dd7ba0244f8a",
    "environmentId": "E573bb9ffd717111220812c3a",
    "type": "physical",
    "edgeId": "F2-50-BC-59-B9-C2",
    "alias": "stereo"
    "meta": {
        "$manufacturer": "FancyHome"
        "location": "LivingRoom",
        "testEquipment": false,
        "modelYear": 2017
        "volumePresets":[23, 39, 51, 72, 88]
    }
}                                                                                            

Sample device D1a0b4f07228ea674ac07b9bc with alias light:

{
    "id": "D1a0b4f07228ea674ac07b9bc",
    "ecosystemId": "C573b86eeee43dd7ba0244f8a",
    "environmentId": "E573bb9ffd717111220812c3a",
    "alias": "light",
    "type": "physical",
    "meta": {
        "$manufacturer": "FancyHome",
        "location": "Garage",
        "testEquipment": true,
        "modelYear": 2016
        "successes": {
            "test1": false,
            "test2": false,
            "test3": true,
            "test4": false
        },
        "colors": ["red", "white", "blue"]
        "brightnessPresets": [7, 23, 42, 69, 86]
    }
}                                                                                                

Sample Requests

Initial Query:

GET https://ioe.droplit.io/api/devices?environmentId=E573bb9ffd717111220812c3a&pageSize=1

Only the first device is returned:

{
    "items: [
        {
            "id": "D573bc694ae9ac9419f028b61",
            "ecosystemId": "C573b86eeee43dd7ba0244f8a",
            "environmentId": "E573bb9ffd717111220812c3a",
            "type": "physical",
            "edgeId": "F2-50-BC-59-B9-C2",
            "alias": "stereo"
            "meta": {
                "$manufacturer": "FancyHome"
                "location": "LivingRoom",
                "testEquipment": false,
                "modelYear": 2017
                "volumePresets":[23, 39, 51, 72, 88]
            }
        }
    ],
    "continuationToken": "1a0b4f07228ea674ac07b9bc"
}

To receive the remaining item, the continuation token can be included in the
next query:

GET https://ioe.droplit.io/api/devices?environmentId=E573bb9ffd717111220812c3a&pageSize=1&continuationToken=1a0b4f07228ea674ac07b9bc

The second, and final, device is received:

{
    "items": [
        {
            "id": "D1a0b4f07228ea674ac07b9bc",
            "ecosystemId": "C573b86eeee43dd7ba0244f8a",
            "environmentId": "E573bb9ffd717111220812c3a",
            "alias": "light",
            "type": "physical",
            "meta": {
                "$manufacturer": "FancyHome",
                "location": "Garage",
                "testEquipment": true,
                "modelYear": 2016
                "successes": {
                    "test1": false,
                    "test2": false,
                    "test3": true,
                    "test4": false
                },
                "colors": ["red", "white", "blue"]
                "brightnessPresets": [7, 23, 42, 69, 86]
            }
        }
    ]
}