Closed deschen1 closed 1 week ago
Awesome, I must have overlooked these helpers. With an additional flatten()
as the first step, these functions also work nicely in case there is an additional list layer (e.g. when combining fetching from an paginated API that is wrapped in a loop/map after building a list of requests (e.g. one per country)).
In a single API call, I can fetch the relevant data, using
httr2::resp_body_json()
, see here: https://httr2.r-lib.org/reference/resp_body_raw.html.However, when I collect data from an API that uses pagination and I'm using httr2's
req_perform_iterative()
function, I'm getting a long list of json objects.Currently I'm doing some
purrr::map
magic to pull the relevant response bodies from the response object, but I'M wondering if there's a more straightforward way orresp_body_json()
equivalent that also works with such pagination responses.