Pagination in Freshservice Custom Objects API is not working

Hi All,

Thanks in Advance.

I am creating a custom app in Freshservice to automate the creation of Onboarding Ticket whenever a new employee is hired in my HRMS System.

I have my list of Job titles in a custom objects.
The list is quite big as it consists of 150+ items in it.

I want to get all the custom object records to do a mapping and create the onboarding ticket with proper job title.

The issue that I am facing here is the GET Api for custom object records only return a maximum of 100 records in a single request.
The page query param doesn’t seem to work here.

And When I referred to the API documentations, I came to know that there will be a next_page_link will be sent along with the response which will be further used to get the next page of records.

It is not working.

The below is the URL.
https://lego-us.freshworksapi.com/v1/entities/140671/records?page_size=100&next_token=2OIIo813r66KlskmtWry6ojtSfwYRtQlcECr7Cc0Pk3Z9tNyvDf1LOM7TVHdl&sort_by=bo_updated_at;DESC"

Can anyone help me with this?

Let me know if I am missing something here.

Hi @Sarnith_Balan,

Could you share the GET API request that has been used, along with the query parameters?
Also, is it possible to share the API response with hidden sensitive information?

I’m facing the same Issue with the custom object. Pagination isn’t working. For example i make GET request:

https://xxx.freshservice.com/api/v2/objects/26000005600/records?page_size=2

Answer is:

{
    "records": [
        {
            "data": {
              removed
            }
        },
        {
            "data": {
                removed
            }
        }
    ],
    "next_page_link": "https://lego-euc.freshworksapi.com/v1/entities/341329/records?page_size=2&next_token=2OIIo813r66Kv9VdRqrmJOKU6AK66fyXrNkvxGNOSIK8TRvFAbrcBWdxIyVHZ&sort_by=bo_updated_at;DESC",
    "meta": {
        "total_records": 27
    }
}

The next page link isn’t working. So I use the “next_token” in me new API Get request:

https://xxx.freshservice.com/api/v2/objects/26000005600/records?page_size=2&next_token=2OIIo813r66Kv9VdRqrmJOKU6AK66fyXrNkvxGNOSIK8TRvFAbrcBWdxIyVHZ

But the API sends the same result as on the first request.

Can you help?

I am running into the same issue. Can we get an ETA on when the Next_page_link will be fixed?

I was running into this same issue. Was on with support and they gave my a clunky work-around (passing a /V1 call into a /V2 endpoint).

This worked on the first “next-page” but returns the same token time and again after that. We are at 200 Max records… I guess thats progress…lol

Sorry to necro an old thread, but I ran into this. You aren’t supposed to load the next_page_link URL directly, it’s another query string parameter that you call instead. The docs kind of reference this, but it’s confusing until you run into this issue then it makes sense.

If you look at the Link header of the response you get, it actually gives you the full URL to call to get the next page of results (which is a normal thing to do, and some languages like Powershell have parameters so that you don’t have to call the next URL yourself, you can tell it to follow “rel” links which are returned in the Link header of REST calls to indicate the next page of results.

So depending on how or in what language you’re working with, you either need to make sure it will follow “rel” links and it’ll just work, or you need to use the value from the Link header on the response, parse it to get just the value, and then call that instead.