Confirm how we page through results

We'd like to test how we page through the response to a GET /thermostat request.

Here is our test case:
- 9 thermostats
- 2 pages of results
- 1st page: tstat1 ... tstat5
- 2nd page: tstat 6 ... tstat9

So, our understanding is that the first response JSON will look like this:
"page": {
"page": 1,
"totalPages": 2,
"pageSize": 5,
"total": 9
}

And the second response will look like this:
"page": {
"page": 2,
"totalPages": 2,
"pageSize": 4,
"total": 9
}

A couple of questions about this:
(1) Is "pageSize" the number of item present in the current response/page? In the example above, it's 5 in the first page/response and 4 in the second page/response; is this realistic?

(2) In order to request further pages, the doc says we should include the "page" object in the request JSON. Do we only need to specify the "page" property of the Page object? For example:
GET https://beta.ecobee.com/home/api/1/th..., page : { page : 2 } }

(3) Related to question 2 above, is it OK if all other properties of the "page" object are being sent anyway with "0" as their value ? For example:
page: { page 2, totalPages: 0, pageSize: 0, total: 0 }

(4) How many thermostats do we need to have in our Utility account before we have to start paginating responses? Is there a way to make a request or configure our Utility account so that we can test paging with the real API?
1 person has
this question
+1
Reply
  • Paging is controlled by the ecobee API (servers) and it is our mechanism to control the size of the response payload to a known fixed maximum. This section of our online documentation answers most of your questions above https://www.ecobee.com/home/developer... (see the Request Paging section).

    The link above provides a sample page request to clarify how you include the page object, and you should include only the 'page' property. It also outlines how we currently are using a page size of 25, so you will only see pagination when the results of any of your requests would return more than 25 thermostats. The 'pageSize' property will always be set at 25. The 'total' property will reflect the actual amount of thermostats that your request generated.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated