Performs one authenticated request against an af_api() profile, applying its
pagination strategy, and returns the parsed body as a tibble. HTTP errors and
connection failures are translated into friendly cli messages.
Usage
af_fetch(api, name, limit = Inf, offset = 0L, query = list(), verbosity = 0L)Arguments
- api
An
apifetch_apiobject (seeaf_api()).- name
The token name to authenticate with (looked up via the API's
service).- limit
Maximum number of records to request. Default
Inf(no limit). Non-positive or infinite values omit the parameter.- offset
Starting record. Default
0(omitted).- query
A named list of additional query-string filters. Default empty.
- verbosity
0(silent, default),1(progress messages), or2(progress plus full HTTP request/response details).
Examples
if (FALSE) { # \dontrun{
api <- af_api("https://www.bigdata.pe.gov.br/api/buscar",
service = "BigDataPE", auth = af_auth_raw(),
pagination = af_paginate_offset("header"))
af_store_token("dengue", "token", service = "BigDataPE")
af_fetch(api, "dengue", limit = 50)
} # }