Custom Object Records: Filter Pagination

See some folks that have asked similar questions, but do not see an solutions listed:

Pagination in Freshservice Custom Objects API is not working - Product - Freshworks Developer Community

When I get the custom object records by custom object id, there is the Headers.Link to perform pagination. However, if I do a call like this:

https://{{fs_base_url}}.freshservice.com/api/v2/objects/21000011818/records?query=category_dd1 : ‘Hardware’&page=1

There is no Headers.Link. Even manually paging with page=2, it’s the same records returned. There is a property next_page_link listed, but no explanation or example on how to use it in the documentation. Any guidance is appreciated as pagination isn’t available in headers.link or manually incrementing the page in the url to detect no content remaining. Another item that is unclear is max records. If per_page = 50 is passed, it’s returning 10 records.

As a side note, there is inconsistency in the API for filtering. For instance, Tickets is:

  • query=“email:‘john.smith@freshservice.com’”…qoutes around the query string, no spaces for key value

but filtering for Custom Object Records is:

  • query=category_dd1 : ‘Hardware’…no qoutes, space between key and value mandatory. If the space is removed between pairs, the API validation fails.

Another note, there is an error in the documentation under Supported request parameters indicating the sort_order key is sord_order.

mememe_9c47550fb1234a580e39c4fc8c952c6c-1

Hey Rob, i use google app script to parse a lot if this data - its just javscript with some minor alterations - but i use the following to get the next page:

After the first call:

 if (response.hasOwnProperty('next_page_link')) {
        next_page = encodeURIComponent(JSON.stringify(response.next_page_link).slice(1, -1));
    } else {
        next_page = "Finished";
    }

then I loop with:

  while (next_page != "Finished") {
        endpoint = 'objects/' + mappingId + '/records?page_size=100&next_page_link=' + next_page
        response = makerequest(method, endpoint, payload);

If you have any issues please feel free to ping me

Hi @Jonathan_Swanston. I use the next page link and manually increment pages for most of the filtering because it doesn’t support paging through the links. The problem is with that specific Custom Object does not have links in the headers or even if you manually say you want page 2, it still returns the first page. Pagination appears to be broken or not implemented, so you can only retrieve one page from my testing. Other endpoints have been successfully implemented with links as you show above.