API - Pagination Information
When requesting information that FreshService paginates (example: All tickets), no information is returned in the header to show how many total results or total pages of information there are.
This ultimately results in a requirement that a number of additional information is determined in consuming the API.
For example, to retrieve all paginated information, one would have to request the first page and determine if the request returned a body with 30 items. If the body does have 30 items, modify the URI being requested and test that result.
That could provide 1 of 3 results.
1. An empty response, signifying that there was exactly 30 items in this view.
2. A result with less than 30 items, signifying that there are no more pages to consume.
3. A result with 30 items, which requires additional requests to determine if there was exactly 60 (or any multiple of 30) items that matched or if there is indeed other pages, looping through the same steps.
This could result in a number of additional and unnecessary requests to the FS API as well as the additional overhead and testing by the consumer.
Inclusion of a Link header or an X-Total-Count could provide this information without changing or breaking existing functionality.
Mike, I agree that returning the total number of pages or records would be useful in this and similar API calls, but as it stands you only need, at most, one additional API call than the total number of pages. Simply check to see if the number of records returned is 0, and if not, increment the page number and request again. As you described, more logic could be built to avoid an additional and unnecessary API call, such as checking for greater than zero but less than the maximum. To expand on your request, I think it would also be beneficial to increase the records returned per page.
Would also be great if the pagination was explained on the API reference. I see nothing here about it: http://api.freshservice.com/#view_all_ticket
Also, the returned data actually looks like the FreshDesk API V2 return, not the example return they have (there is no 'helpdesk_ticket' at the start of each ticket). This makes the json object hard to parse, no?
Is any one able to get the list of tickets to paginate past page 1? I'm just using CURL to test the calls.
If I try GET https://mysubdomain.freshservice.com/helpdesk/tickets.json?page=1 it returns data, if I go to page=2 and up I only get 
If I try GET https://mysubdomain.freshservice.com/helpdesk/tickets/filter/all_tickets?format=json&page=1 It returns data but always only the first page and shows this error at the end: 'page' is not recognized as an internal or external command, operable program or batch file.
Appreciate any help!