Unclear about API response schema for pagination | Community
Skip to main content

I was trying the List collections endpoint under the Help Centre APIs using Pagination
Th Pagination Guide describes List APIs as using cursor based pagination, with the “next” parameter containing the “starting_after” parameter which can be used to fetch the next page of results

However, when I tried the List collections endpoint I got this as the result for the “pages” parameter. The “next” parameter gives a URL, not an object as described in the docs
"pages": {
    "type": "pages",
    "next": "https://api.intercom.io/help_center/collections?per_page=1&page=2",
    "page": 1,
    "per_page": 1,
    "total_pages": 4
  }

Here are the headers I used for reference:

{

“Authorization”: “Bearer <token>“,

“Accept”: “application/json”,

“Intercom-Version” : “2.13”

}

Since I’m passing the intercom-version I don’t expect this to be an error with the version. 

Please explain the correct way to use Pagination

I see a related issue here. However I’m unsatisfied with the solution provided. In case the API is updated one day in keeping with the docs it would break our workflows.

Hey ​@Dev Accts 👋 Jacques here from Intercom Support. I hope all is well today!

I believe the issue here is that the Help Centre Collections API is currently using offset-based pagination, which is why you're seeing:

"pages": {

    "type": "pages",

    "next": "https://api.intercom.io/help_center/collections?per_page=1&page=2",

    "page": 1,

    "per_page": 1,

    "total_pages": 4

}

To use this pagination:
  • Make your initial request with per_page parameter
  • Use the next URL directly to get the next page
  • Continue until there is no next URL (indicating you've reached the last page)

Hope this is clear! Let me know if you have any further questions 👍


Hi Jacques, 

Thanks for the answer. It works for me. Is there a place this is logged officially? I didn’t see a mention of offset based pagination for the help centre API and I don’t want to be left in the dark in case this changes in line with the other cursor based pagination APIs.


Hey ​@Dev Accts 👋 Glad we got this resolved for you!

Currently our Docs haven’t been updated with these changes so I’ll need to make a not of this and pass it on to our team to get this updated.

I agree it isn’t ideal that we don’t have this documented, so I’ll get this looked at ASAP.


Reply