Recent searches


No recent searches

ZenDesk API pagination doesn't work



Posted Mar 31, 2022

 

Hi all,

The API listed here doesn't work for pagination.

https://developer.zendesk.com/api-reference/ticketing/jira/links/

 

Following the example posted here:

https://support.zendesk.com/hc/en-us/community/posts/4416466641306-Unable-to-get-more-than-1000-records-for-jira-links

results in an error. 

Trying to use the API with pagination results in an error.

$ curl -u account:password -X GET "https://ourcompany.zendesk.com/api/v2/jira/links?page[after]=1000"

curl: (3) bad range in URL position 57:
With a caret designating an error, pointing directly undeneath the opening brace for [after]
                                                                                ^^ error message


Regardless of whether I single quote, double-quote, or unquote the URL.

 

Whereas, trying to use the API without pagination works perfectly, I get exactly 1000 records.

But I have over 2k records I need to get, with Jira links. 

Thanks for any help.

K


0

4

4 comments

image avatar

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


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


image avatar

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


Brilliant!  

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

K

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post