Skip to main content

Fetch coversation without limit


It seems that API to fetch the ticket conversation will return the first 30 conversation, I need all the conversation without setting the page number in the API url, is there any way to get all the conversation

Did this topic help you find an answer to your question?
This topic has been closed for comments

4 replies

  • Contributor
  • 17 replies
  • August 2, 2018

Just loop through all of the pages in your app. Response pagination is pretty common.


what if i dont know the number of pages , how will i get all the conversation?



  • Contributor
  • 17 replies
  • August 2, 2018

There's a few different ways, but here's a simple one:


1. Hit the endpoint with pageNumber=1

2. If the response has a length = 30, hit the endpoint with pageNumber++

3. If the response has a length < 30, stop.


aravind.sundararajan
Skilled Expert
Forum|alt.badge.img+12

Hello,


When you hit the API endpoint, the server returns the response along with the 'link' header. It indicates if the next page exists and provides the url of the page. You can adjust your script so that the value of the link header is taken into consideration and the API call gets updated accordingly. Sample link header:


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


Cheers!