{"_id":"5a736616c037f5006b9c561a","project":"568bdc1483d2061900d86cdc","version":{"_id":"59a72290d61777001b6c42c3","project":"568bdc1483d2061900d86cdc","__v":33,"createdAt":"2017-08-30T20:39:44.453Z","releaseDate":"2017-08-30T20:39:44.453Z","categories":["59a7236e3fe4d90025117c10","59a72eb6cb0db3001b84cfe2","59a734eb757d030019b85af8","59c0243b1b2d07001a9d2b76","59c035e42126e10028effb12","59c06c40df5b3c0010584a13","59c1a5852cabe5002641a3e7","59c2fb00b2b45c0010b7a3d7","59c32ceb9aea850010ac4130","59c32e6e190c90003cb0d12f","59c33affb2b45c0010b7aa23","59c7dfa457bd8200105444dc","59c7e975c50cf30010d712a0","59cffdef0cd4dd0010294d54","59d0622ca91a810032c8f60c","59d06733c1aec60026253065","59d174d44ac471001a07b123","59d5a5e323e6e800103defb2","59ecf1d8ed507c001c52b255","59f76fef8581dc0010593e6f","5a0c003680a35b0012c35db0","5a8358722e78660075e45f42","5a846645b5ec3a001203517e","5b258091bc7a6700033b9cb5","5b26e48e024807000315a740","5b44edff3306680003663f5c","5b468abd3d4a9e0003789111","5b468d8f3dcb6a0003c6e374","5b47b0b93d4a9e000378a33a","5b538d114ea24f00033c726f","5b6a0efe402b32000336c33f","5bba5e5d7ba7710003bd902a","5bc2703349ac3a0013eec3e5"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"0.0.0","version":"0"},"category":{"_id":"5b47b0b93d4a9e000378a33a","project":"568bdc1483d2061900d86cdc","version":"59a72290d61777001b6c42c3","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2018-07-12T19:49:13.569Z","from_sync":false,"order":12,"slug":"features","title":"Features"},"user":"5a6a26281895510045b2cd40","githubsync":"","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-02-01T19:10:14.655Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"# Overview\n\nPagination 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.\n\n# Details\n\nThe 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.\n\n# Example\n\n## Sample Environment\n\nSample device `D573bc694ae9ac9419f028b61` with alias `stereo`:\n\n```\n{\n    \"id\": \"D573bc694ae9ac9419f028b61\",\n    \"ecosystemId\": \"C573b86eeee43dd7ba0244f8a\",\n    \"environmentId\": \"E573bb9ffd717111220812c3a\",\n    \"type\": \"physical\",\n    \"edgeId\": \"F2-50-BC-59-B9-C2\",\n    \"alias\": \"stereo\"\n    \"meta\": {\n        \"$manufacturer\": \"FancyHome\"\n        \"location\": \"LivingRoom\",\n        \"testEquipment\": false,\n        \"modelYear\": 2017\n        \"volumePresets\":[23, 39, 51, 72, 88]\n    }\n}                                                                                            \n```\n\nSample device `D1a0b4f07228ea674ac07b9bc` with alias `light`:\n\n```\n{\n    \"id\": \"D1a0b4f07228ea674ac07b9bc\",\n    \"ecosystemId\": \"C573b86eeee43dd7ba0244f8a\",\n    \"environmentId\": \"E573bb9ffd717111220812c3a\",\n    \"alias\": \"light\",\n    \"type\": \"physical\",\n    \"meta\": {\n        \"$manufacturer\": \"FancyHome\",\n        \"location\": \"Garage\",\n        \"testEquipment\": true,\n        \"modelYear\": 2016\n        \"successes\": {\n            \"test1\": false,\n            \"test2\": false,\n            \"test3\": true,\n            \"test4\": false\n        },\n        \"colors\": [\"red\", \"white\", \"blue\"]\n        \"brightnessPresets\": [7, 23, 42, 69, 86]\n    }\n}                                                                                                \n```\n\n## Sample Requests\n\nInitial Query:\n\n```\nGET https://ioe.droplit.io/api/devices?environmentId=E573bb9ffd717111220812c3a&pageSize=1\n```\n\nOnly the first device is returned:\n\n```\n{\n    \"items: [\n        {\n            \"id\": \"D573bc694ae9ac9419f028b61\",\n            \"ecosystemId\": \"C573b86eeee43dd7ba0244f8a\",\n            \"environmentId\": \"E573bb9ffd717111220812c3a\",\n            \"type\": \"physical\",\n            \"edgeId\": \"F2-50-BC-59-B9-C2\",\n            \"alias\": \"stereo\"\n            \"meta\": {\n                \"$manufacturer\": \"FancyHome\"\n                \"location\": \"LivingRoom\",\n                \"testEquipment\": false,\n                \"modelYear\": 2017\n                \"volumePresets\":[23, 39, 51, 72, 88]\n            }\n        }\n    ],\n    \"continuationToken\": \"1a0b4f07228ea674ac07b9bc\"\n}\n```\n\nTo receive the remaining item, the continuation token can be included in the\nnext query:\n\n```\nGET https://ioe.droplit.io/api/devices?environmentId=E573bb9ffd717111220812c3a&pageSize=1&continuationToken=1a0b4f07228ea674ac07b9bc\n```\n\nThe second, and final, device is received:\n\n```\n{\n    \"items\": [\n        {\n            \"id\": \"D1a0b4f07228ea674ac07b9bc\",\n            \"ecosystemId\": \"C573b86eeee43dd7ba0244f8a\",\n            \"environmentId\": \"E573bb9ffd717111220812c3a\",\n            \"alias\": \"light\",\n            \"type\": \"physical\",\n            \"meta\": {\n                \"$manufacturer\": \"FancyHome\",\n                \"location\": \"Garage\",\n                \"testEquipment\": true,\n                \"modelYear\": 2016\n                \"successes\": {\n                    \"test1\": false,\n                    \"test2\": false,\n                    \"test3\": true,\n                    \"test4\": false\n                },\n                \"colors\": [\"red\", \"white\", \"blue\"]\n                \"brightnessPresets\": [7, 23, 42, 69, 86]\n            }\n        }\n    ]\n}\n```","excerpt":"Break up one lengthy response into several smaller responses.","slug":"pagination","type":"basic","title":"Pagination"}

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] } } ] } ```