Skip to content
Advertisement

Freshdesk api call returning limited number of tickets

I’m trying to fetch ticket details using requests library of python. Here is the command.

r = requests.get("https://"+ domain +".freshdesk.com/api/v2/tickets?updated_since=2015-01-19T02:00:00Z", auth = (api_key, password))

But, I’m just getting latest 30 tickets details.

I tried changing the date and also tried removing it, but nothing seems to work and everytime only last 30 tickets details are coming.

Advertisement

Answer

It’s due to pagination limit set by Freshdesk.

Refer: https://developers.freshdesk.com/api/#pagination

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

Example:

Headers:
"link":< https://domain.freshdesk.com/api/v2/tickets?filter=all_tickets&page=2>;rel="next"
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement