Paginating through lists

Have more questions? Submit a request

4 Comments

  • Tanawat Oonwattana
    Comment actions Permalink

    Hi,

    Is there anyway that we can call API that can go directly to the last page?

    for example, I am calling this endpoint:

    /api/v2/search.json?query=type:ticket+tags:"order_related"+status<pending&per_page=30&page=1&sort_by=created_at&sort_order=asc

    you can see that I am limiting data to be displayed only 30 items per page.

    and how do I call the API to get me to the last page directly?

    Thank you.

    0
  • Dwight Bussman
    Comment actions Permalink

    Hi Tanawat,

    Would it be possible to set your sort_order=desc instead of ascending, so that the results which would've previously been on the last page would now return on the first page?

    0
  • Carsten Bredsdorff
    Comment actions Permalink

    It looks as though the after paging URL/functionality is broken in your Ticket Audits API:

    https://xxxxxx.zendesk.com/api/v2/ticket_audits.json?cursor=MTYwMTA0NjY4OC4wfHwxMjE0Mjk4OTIxODMyfA%3D%3D

    The after cursor returns the most recent data from the API, regardless of where in time the after cursor is returned in the paging. The after cursor above was returned from a set of data back on 9/25/2020. The before cursor works and will return data prior to this, but the after cursor returns data from 10/16, even though it should return the page after the current cursor.......

    0
  • Bryan - Community Manager
    Comment actions Permalink

    Hello Carsten Bredsdorff,

    The /api/v2/ticket_audits.json API (without any cursor query parameter value) will return the latest 1000 ticket audit records. The before and after cursors from that result set will "lock in" the time relative to when this API request was made.

    So for example, if you run /api/v2/ticket_audits, the after cursor returned at that moment will immediately return an empty result set but will return the next 1000 records, once they are created. I think this is working as designed but maybe not as expected.

    If you are interested in a more incremental, time based export, I'd check out Exporting ticket events, which has the ability to specify a specific start_time query parameter (where ticket_audits does not recognize the start_time query parameter).

    If this does need further investigation, please contact Zendesk Customer Support as this will require 
    Granting Zendesk temporary access to your account
     to look at your specific account's data.

    0

Please sign in to leave a comment.

Powered by Zendesk