6 Automation Capabilities to Modernise your Service DeskRegister now

Start a new topic

Api - count of all created tickets

Hi - I already went through the articles that might be related to my problem but couldn't find any solution. 

I simply want to know the count of all created tickets in our support department.

When I'm sending the request https://xxxxxxx.freshservice.com/helpdesk/tickets/view/12345?format=json"

... I only get the first 30 results back. The only possibility I see here is to loop through all pages by using ?page=X - in case the result is again 30 I go with ?page=2 and so on.

The problem here is that I do not know if there is a "next page" if my result is again 30. Could be that there are exact 30 tickets 

But anyway, this isn't really the solution what I am looking for - there must be an easier way since I already see the total count of tickets in the web GUI, in my view!

Maybe I missed something in the Api documentation. help please :-)

Unfortunately I believe that is the only way at the moment.

We have hourly exports setup to import into another system for reporting and we ended up using a custom report which exports to csv which is then automatically processed; otherwise the api limit keeps getting hit if we run through all the pages.

There is version 2 of the api in the pipe line I believe... 

@fs Can you comment on rumors of API v.2?!


Hi All, 

I hope you might have already noticed, if not we have released API V2 

You can access the document by visiting API V2

@Andreas to answer your question, have you tried "URL?format=json&page=1" in the URL, this help you navigate through pages.

Hope this helps, feel free to reach out for any help.

Freshservice Support 

Hi Jayesh,

thanks for your reply.

As I wrote -

The only possibility I see here is to loop through all pages by using ?page=X - in case the result is again 30 I go with ?page=2 and so on.

That means I loop through the pages until I come to the end. Then just simply multiply Nr. of loops * 30. 
but - this is not accurate enough.  

Correct. The v2 API is not very robust.  It would be nice if we could request aggregate numbers. i.e. total tickets, open ticket, closed tickets, etc and then add filtering like 'last 7 days', last month, etc.

1 person likes this

having the ability to do this would make life so much easier!!

You can check to see if you have more pages to return by checking for a returned header. yes you still have to loop and loop but at least you can so some checking

The 'link' header in the response will hold URL of the next page, if it exists. If you have reached the last page of objects, then the link header will not be set.

"link":< https://domain.freshservice.com/api/v2/tickets?filter=all_tickets&page=2>;rel="next"

Login or Signup to post a comment