Getting tickets, capped at 42 pages | The place for Zendesk users to come together and share
Skip to main content
August 27, 2021
Question

Getting tickets, capped at 42 pages

  • August 27, 2021
  • 5 replies
  • 22 views

Hi everyone! I recently started using the API for zendesk, and in a order from our admin I am trying to query for all tickets older then 2 years, to delete them. However, I am getting capped at 42 pages for tickets (4186 tickets), we should however have around 23k tickets, why am I not getting all of them?

 

Br,

Nikolai

 

5 replies

Tipene
Employee
August 27, 2021

Hey @Nikolai Poverud,

Thanks for reaching out!

I'll be happy to take a look at this one for you. Can you provide an example of the request you're making to the API? Just be sure to redact any sensitive information, as well.

Tipene

Nikolai11Author
August 27, 2021

Hi @Tipene Hughes,

I have no idea if this is right, but I am just trying to query the tickets.json endpoint, /api/v2/tickets from powershell. I have even tried to make a loop, to loop through all pages, 1-100.

Im on a different computer right now, but I guess there is no need for a screenshot. 

Will of course add one if you want it. 

 

Tipene
Employee
August 30, 2021

Thanks for the context, @Nikolai Poverud! Most likely what’s happening here is that a bunch of the tickets in your Zendesk instance have been archived and therefore not included in the response from the /api/v2/tickets API call. If you’d like to get all tickets including archived, you can use the Incremental Exports API. Here’s a bit more information on using that endpoint:

https://developer.zendesk.com/documentation/ticketing/managing-tickets/using-the-incremental-export-api/

Feel free to let me know if you have any questions!

Tipene

Nikolai11Author
September 1, 2021

Thank you, @Tipene Hughes. However, I would like to export all tickets prior to two years ago, is that possible? As the incremental export endpoint only supports start_time. 

 

Thank you,

Nikolai

Tipene
Employee
September 2, 2021

After looking in to this a bit more, it seems like the Search API might be more in line with what you're looking for, specifically, Export Search Results.

Here's an example snippet using that endpoint:

https://{subdomain}.zendesk.com/api/v2/search/export?query=created_at<2019-09-02&filter[type]=ticket

Let me know if this works for you and if you have any questions!

Tipene