{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","params":[],"results":{"codes":[]},"settings":""},"next":{"description":"","pages":[]},"title":"Pagination","type":"basic","slug":"pagination","excerpt":"","body":"Currently we only support cursor-based pagination, which is typically more optimal than offset-based.\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"`before`    \",\n    \"1-0\": \"`after`\",\n    \"2-0\": \"`limit`\",\n    \"0-1\": \"Passing `before` in your requests with an ID will only return records who's IDs come before the supplied ID.\",\n    \"1-1\": \"Passing `after` in your requests with an ID will only return records who's IDs come after the supplied ID.\",\n    \"2-1\": \"Each endpoint has a default limit, but most are lower than the supported maximum. You can pass `limit` in your requests to increase or decrease the number of results returned.\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"An Example\"\n}\n[/block]\nBelow is an example of how you can paginate through donations. First, you would call the [/donations](doc:donations) endpoint and get your first page of results:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://streamlabs.com/api/v1.0/donations?access_token=YOUR_ACCESS_TOKEN&limit=50\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{  \\n\\t\\\"data\\\":[  \\n  \\t{  \\n    \\t\\\"donation_id\\\":\\\"79808132\\\"\\n      //...\\n    },\\n    //...\\n    {  \\n      \\\"donation_id\\\":\\\"79530994\\\"\\n      //...\\n    }\\n\\t]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nAnd then, to grab the next page of results you would pass the last `donation_id` as your `before` parameter:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://streamlabs.com/api/v1.0/donations?access_token=YOUR_ACCESS_TOKEN&limit=50&before=79530994\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]","updates":[],"order":5,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"55bee746ad601c2b00762bd8","__v":13,"createdAt":"2015-08-03T04:00:06.493Z","parentDoc":null,"user":"55baca333f0767230008f4ff","project":"55baca9cd0736b3100bf1008","githubsync":"","version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["55baca9dd0736b3100bf100c","55bacba0d0736b3100bf1017","55bad8f33f0767230008f517","55baf3f01b0d66370078166e","55baf4151b0d66370078166f","55f1cca35fe76419007dc794","573e2d6e610a090e00ca2b97","58d97ce57718211b0028e6bc","599b510cb683b50031a35299","5a871c493948fd004697e677"],"_id":"55baca9cd0736b3100bf100b","createdAt":"2015-07-31T01:08:44.540Z","project":"55baca9cd0736b3100bf1008","__v":10,"releaseDate":"2015-07-31T01:08:44.540Z"},"category":{"sync":{"isSync":false,"url":""},"pages":["55baca9dd0736b3100bf100e","55baf4053f0767230008f52d","55bafa293f0767230008f536","55bafd35d0736b3100bf1052","55bb033f3f0767230008f544","55bee746ad601c2b00762bd8"],"title":"Documentation","slug":"documentation","order":0,"from_sync":false,"reference":false,"_id":"55baca9dd0736b3100bf100c","version":"55baca9cd0736b3100bf100b","project":"55baca9cd0736b3100bf1008","__v":6,"createdAt":"2015-07-31T01:08:45.128Z"}}
Currently we only support cursor-based pagination, which is typically more optimal than offset-based. [block:parameters] { "data": { "0-0": "`before`    ", "1-0": "`after`", "2-0": "`limit`", "0-1": "Passing `before` in your requests with an ID will only return records who's IDs come before the supplied ID.", "1-1": "Passing `after` in your requests with an ID will only return records who's IDs come after the supplied ID.", "2-1": "Each endpoint has a default limit, but most are lower than the supported maximum. You can pass `limit` in your requests to increase or decrease the number of results returned." }, "cols": 2, "rows": 3 } [/block] [block:api-header] { "type": "basic", "title": "An Example" } [/block] Below is an example of how you can paginate through donations. First, you would call the [/donations](doc:donations) endpoint and get your first page of results: [block:code] { "codes": [ { "code": "https://streamlabs.com/api/v1.0/donations?access_token=YOUR_ACCESS_TOKEN&limit=50", "language": "text" } ] } [/block] [block:code] { "codes": [ { "code": "{ \n\t\"data\":[ \n \t{ \n \t\"donation_id\":\"79808132\"\n //...\n },\n //...\n { \n \"donation_id\":\"79530994\"\n //...\n }\n\t]\n}", "language": "json" } ] } [/block] And then, to grab the next page of results you would pass the last `donation_id` as your `before` parameter: [block:code] { "codes": [ { "code": "https://streamlabs.com/api/v1.0/donations?access_token=YOUR_ACCESS_TOKEN&limit=50&before=79530994", "language": "text" } ] } [/block]