ZenDesk API pagination doesn't work

4 Kommentare

  • Sean Bourke
    Zendesk Product Manager

    Hi Kahele Koenig,

    The page[after] property relates to an explicit Jira link ID, rather than a paged index.

    If you create a request with the page[size]=1000 property to attain your first 1,000 links, the response should also include an after_cursor which represents the request to attain the next 1,000 links. You should be able to iterate through these until has_more is false, represent the end of the available links.

    If you use the after_cursor URL provided in the response, do you still get the same issue as above?

    0
  • Kahele Koenig

    Hi Sean,

    Thanks for the response.

    All of these commands work, but only give me the 1st 1,000 records:

    https://mycompany.zendesk.com/api/v2/jira/links
    https://mycompany.zendesk.com/api/v2/jira/links?after_cursor
    https://mycompany.zendesk.com/api/v2/jira/links?after_cursor=true

    If I look at the last record obtained in any of these successful retrievals (which yield exactly one thousand records, the default), it ends with the following statement on the 1,000th record:

    "updated_at":"2021-04-27T23:40:28.000Z"}],"total":1984,"meta":{"has_more":true,"after_cursor":"https://mycompany.zendesk.com/api/v2/jira/links?page[after]=22016890"}}

    However, If I try to use that referenced URL or any of the following commands, it does not work. 
    Notice the caret (^) line underscoring the opening bracket forming the [after], indicating its use in the requested syntax is considered to be an error, everytime. 

    curl: (3) bad range in URL position 57:
    https://mycompany.zendesk.com/api/v2/jira/links?page[after]=22016890
                                                                                           ^
                                                            
    curl: (3) bad range in URL position 57:
    https://mycompany.zendesk.com/api/v2/jira/links?page[size]=1000
                                                                                          ^

    curl: (3) bad range in URL position 57:
    https://mycompany.zendesk.com/api/v2/jira/links?page[size]=2000
                                                                                           ^

    If there's something simple I'm missing, appreciate any correction/guidance. 


    Thanks again. 

    0
  • Sean Bourke
    Zendesk Product Manager

    Hey Kahele Koenig,

    Thanks for the additional details. It looks like your curl requests may be interpreting the brackets as a globbing pattern, resulting in the bad range response. If you make the request with the -g option, does it work?

    0
  • Kahele Koenig

    Brilliant!  

    Thanks Sean, good eye, and great catch.  :- )    Appreciate the clarify and solution. 

    K

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.

Powered by Zendesk