HTTP Pagination error

Describe the problem/error/question

When using the pagination feature and the same dataset is returning. The endpoint is available here https://api-docs.practicebetter.io/#/operations/ConsultantClientSession_List

Each request returns a maximum of 100 items by default.

We can paginate using a “skip” query.

Given that $pageCount should keep track of the number of pages, I should be able to use

{{$pageCount * 100}}

for this query parameter, right?

I have “Pagination Complete When” set to this expression:

{{ $response.hasMore === false }}

What is the error message (if any)?

The Practice Better API response is returning the same dataset each time, rather than skipping/paginating.

Please share your workflow

Information on your n8n setup

  • n8n version: 1.86.0
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via n8n cloud:
  • Operating system: macOS

Hi,

You didn’t mention what the exact error was.

reg,
J.

Apologies, the error is that each call to the API is returning the exact same response. It is not actually skipping/paginating

Hi, ok, so you can confirm you have more than 100 entries?

reg,
J.

1 Like

yes, the “count” in the response lists 4348 items, and hasMore is true

And lastly, the “count” item is the same regardless of if we’re pulling the first 100 items or the last 100 items (i.e. the “count” from the PB API is static and does not change)

Ok, so if you set a manual skip value in the query (you get other but static results?)

Yes, if I set skip to 100, I get the next 100.

If I set skip to 1, I get 100 items; skipping over the first item from when skip = 0.

Hi,

I’m kind of out of ideas TBH.

Some things I see on the screenshot that are weird to me (although setting the manual skip works):

  1. the URL has a space in it https://api.practicebetter.io /consultant/sessions)
    • Make sure you have a clean and correct url
  2. send query parameters is set but there is nothing set (pagination setting is independent of this)
    • disable it, if you don’t need it.

Some other thing to check:

how are the requests sent in the developer console of you browser? Do you see the correct query string being updated or do you see an incorrect format or something else?

Reg,
J.

Thanks for trying J. Really appreciate it. I literally changed things back so that it shows exactly what’s above and it works now. I think we (me and my computer) are tired. Thanks again.

1 Like