Skip to main content

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



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?





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.




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!