[New HTTP module] Token-based pagination with optional token

:bullseye: What is your goal?

I’m trying to query an external API with a GET request that can return paginated answers.
The pagination is handled by a token system. If the results are spread over more than one page, the answer include a “next_token” path that needs to be included as a parameter in a subsequent call.

:thinking: What is the problem & what have you tried?

My setup works fine when there are more than one page of answers. But on occasion, all the answers are included in the first page. When that happens, the “next_token” path is empty. This seems to not agree with the new HTTP module setup.

:clipboard: Error messages or input/output bundles

Error in pagination setup: returned two identical pages in a row Please check pagination fields for typos or incorrect values.

1 Like

Hello,

Without sample data, it is hard to determine where your issue is.
Can you upload a response sample? Maybe tell us what API you are using if thats public one?

If you suspect incorrect behavior of the module, please contact Make.com support directly.

3 Likes

I don’t really have a response sample since the bundles that run with that configuration directly trigger the above error.
The endpoint I’m querying is this one : Ezus API Reference

I think the problem lies with the fact that if there is no pagination (ie only one page), the API still sends the “next_token” path, leaving it empty. The Make module then tries to query the next page with a “next_token=[empty]” header, which is the equivalent of the first call, hence the returned two identical pages in a row
What could help would be a way to tell the module that it should use “next_token” as a source for the pagination token UNLESS that path is empty.
Does that make sense to you ?

Hello @JBR,

Please contact support - in my opinion it should be handled via the HTTP module itself. I do not have any sandbox endpoint which acts the same way as yours to test it out.

Maybe @DavidGurr_Make or @Valery.Mezencev will have idea how to solve your issue.

If you are looking for a temporary solution - I would suggest using an additional HTTP module without pagination to check if the response contains a pagination token and a router with two routes - for paginated and non-paginated results.

It’s definitely not the most convenient solution but the only one that comes to mind except building our own pagination mechanism like we had to do with the previous version of the HTTP module.

Have a nice day!

1 Like

Hello @JBR ,

We already identified your pagination issue and found a solution. The fix is easy and on the way.

Once the fix is released, I will let you know.

Thank you!

5 Likes