Skip to content

How can I paginate an API with http_client #752

@wirtsi

Description

@wirtsi

Hey

I am trying to read through a REST API that returns 100 results and that gives a cursor ... this cursor allows me to read the next batch. So the field cursor.next of the response contains the reference that should be included in the query params.

input:
  read_until:
    check: this.cursor.next == ""
    restart_input: true
    input:
      http_client:
        url: "<api>/products?cursor=${! json(cursor.next) }"

Gives me a

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x44ed43b]

I guess this is because json doesn't like that there is no data yet.

Am I doing this right? Or what is the suggested approach in such a case?

bests & thanks a lot

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementinputsAny tasks or issues relating specifically to inputs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions