Skip to content
Discussion options

You must be logged in to vote

Paginated collections on HTTP APIs are common

That is true, but rarely used in policy, as evaluation time is often critical. But if it isn't – is the total number of pages known? If so I suppose you could iterate over the pages in a comprehension:

collected := [item |
    n := numbers.range(1, stop)
    some item in http.send({"method": "GET", "url": sprintf("%s%d", [base, n])}).body.items
]

Another option would be to put a tiny service in front of this API that would deal with the pagination, and have OPA served a single page.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@devonsparks
Comment options

Answer selected by devonsparks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants