Legacy Dev Forum Posts

 View Only

Sign Up

  • 1.  Retrieve all stations

    Posted 06-05-2025 18:11

    skansakar | 2016-10-31 15:24:45 UTC | #1

    Is there anyway to get a list of all stations using a single API call?

    When I make a GET request to /api/v2/stations I can only get total of 25 stations.

    I have tried to change the pageSize to 500 and passed it in the quest (GET /api/v2/stations?pageSize=500) but this does not seem to have any effect.

    Any ideas?


    tim.smith | 2016-10-28 15:24:41 UTC | #2

    Does modifying the page number to a different value have any effect? Does it work at 10? 30? 100? Just trying to understand if the page size isn't working for you at all or if it's just not working at 500.


    skansakar | 2016-10-28 15:28:05 UTC | #3

    PageSize does work for 10, 30 and 100.

    For anything > 100, it seems to revert back to 25!


    chuck.pulfer | 2016-10-28 15:33:21 UTC | #4

    As you have found out there is a limit of 100 results per page. If you wanted all of them then you'd need to iterate across all the pages.


    skansakar | 2016-10-28 15:37:56 UTC | #5

    Feels more like a defect to me. Otherwise why not set to 100?

    In addition, how do I know how many pages do I need to iterate? As far as I can see, there isn't anything to indicate this.


    tim.smith | 2016-10-28 15:42:14 UTC | #6

    skansakar, post:5, topic:552
    Feels more like a defect to me. Otherwise why not set to 100?

    It's limited to 100 to limit payload sizes to a reasonable size and keep requests quick. It defaults to 25 for the same reason. The limits for every paged resource are determined by the dev team to keep the services running smoothly.

    skansakar, post:5, topic:552
    In addition, how do I know how many pages do I need to iterate? As far as I can see, there isn't anything to indicate this.

    Have a look at the Tips and Tricks on API Paging.


    chuck.pulfer | 2016-10-28 15:45:04 UTC | #7

    I created a ticket to improve the paging API-2051 . When I tried it out I see that the total is not getting set correctly. I set the pageSize to 5 and I see 5 in the total. It should be the total number of stations (if known). In several of the listings throughout the api the total number of entries isn't known until you reach the last page.

    { ... "pageSize": 5, "pageNumber": 1, "total": 5, "selfUri": "/api/v2/stations?pageSize=5&pageNumber=1", "firstUri": "/api/v2/stations?pageSize=5&pageNumber=1", "lastUri": "/api/v2/stations?pageSize=5&pageNumber=1", "pageCount": 1 }


    skansakar | 2016-10-28 15:51:04 UTC | #8

    tim.smith, post:6, topic:552
    Have a look at the Tips and Tricks on API Paging.

    May be I am not understanding this but ....

    Determining if more results are available can be evaluated in two ways:

    Compare the response properties of pageNumber with pageCount. If pageNumber == pageCount, there are no more pages. If pageNumber < pageCount, add 1 to pageNumber and specify that value in the next request to get the next page.

    Check for a value in the response property nextUri. If a value exists, it will be the path to the next page. If it does not exist, there are no more pages.

    For my response, both the pageNumber and pageCount is 1 on page 1. On page 2, the pageNumber is 2 but the pageCount is still 1. What is the pageCount meant to show? Is it number of pages?

    Also, there is no 'nextUri' on this response.


    tim.smith | 2016-10-28 16:03:48 UTC | #9

    skansakar, post:8, topic:552
    For my response, both the pageNumber and pageCount is 1 on page 1. On page 2, the pageNumber is 2 but the pageCount is still 1.

    That's caused by the same bug that Chuck just opened. I'll note this specifically to make sure it's fixed as well.

    skansakar, post:8, topic:552
    Also, there is no 'nextUri' on this response.

    That's not so much a bug as a side effect of the bug. Because the resource thinks it's on the last page already (1 of 1 or 2 of 2), it intentionally does not generate a nextUri.


    skansakar | 2016-10-31 09:57:32 UTC | #10

    @tim.smith @chuck.pulfer do you know when this is likely to be fixed?

    Meanwhile, is there any workaround I can implement so that I can iterate through all pages and get a list of stations?


    tim.smith | 2016-10-31 14:36:51 UTC | #11

    It's currently being worked on. It will probably make it to production next week.

    skansakar, post:10, topic:552
    is there any workaround

    The paging won't be correct until this is fixed, so there's not anything you can do to fix it in the meantime.


    skansakar | 2016-11-16 14:41:56 UTC | #12

    @tim.smith looks like the limit for pageSize has changed from 100 to 500? Is this going to change again? Or can I rely on this to stay 500 and use it?


    tim.smith | 2016-11-16 14:47:07 UTC | #13

    Paging limits are set uniquely per resource, and are subject to change based on periodic reviews by the dev team that owns the resource. The limits are determined by striking a balance between usability (higher limits) and system performance (lower limits).


    skansakar | 2016-11-16 14:52:01 UTC | #14

    tim.smith, post:13, topic:552, full:true
    Paging limits are set uniquely per resource, and are subject to change based on periodic reviews by the dev team that owns the resource. The limits are determined by striking a balance between usability (higher limits) and system performance (lower limits).

    By resource, do you mean per client or entities such as queues, stations, agents etc?


    tim.smith | 2016-11-16 16:23:54 UTC | #15

    No, per API resource. Like GET /api/v2/users/me is one resource.


    system | 2017-08-28 19:28:15 UTC | #16


    This post was migrated from the old Developer Forum.

    ref: 552