HTTP Pagination with Next URL Error

  • n8n version: 1.54.4
  • Database: None
  • n8n EXECUTIONS_PROCESS setting: Main
  • Running n8n via: n8n cloud
  • Operating system: MacOS

New to n8n but have some experience with automation. Trying to call API that contains pagination (i.e. &page=1, &page=2, etc.) The great part is the result contains the NEXT URL that I need to call HOWEVER n8n’s feature where we can throw that Next URL into the original HTTP node errors out for some reason. I have tried including the headers and body in response and nothing seems to be working.

Below are the screenshots. Let me know if I am doing something wrong.

The error I receive when running the workflow. I know for a fact that the “next” field is there (as you can see from the original screenshot).

Thanks!

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Updated Original Post. Thank you!

Hi @Nick_A ,

Welcome to the community! :tada:

Have you tried running this request in something like Postman? If not, could you try and check what the actual value of the next url comes back as?

Thanks for suggestion. See below, I show the response from the initial GET which includes the “next” URL and then I also show the response from that next URL as well which shows the “next” URL as null. In theory, this API is structured perfectly for n8n’s feature for Pagination where response contains next URL and pagination complete when its null.

My assumption here is that I am missing something regarding the $response from the HTTP call itself. When running it, I get an error that the field doesn’t exist so something is happening on the n8n side. Thoughts?

INITIAL GET

Running the NEXT URL

To be more clear, inside n8n HTTP node. I have the initial GET (not including any page parameter). When I test that and get a response (that includes the NEXT URL), I am able to add the pagination feature on and use the $response variable to identify the correct URL I am looking for (see below verified by green highlighted text). Immediately, if I test the node again, it fails with the undefined URL error.

Verified Variable for Next URL

This is the change in variable when simply re-running the same node after verifying the next url as above.

This is the error

Hey @Nick_A,

Can you update the “Pagination Completed When” to use an expression so it ends if the body.next is empty?

1 Like

That worked! Thanks @Jon

Here is what I used for anyone else looking for solution.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.