Bundles an endpoint URL with its authentication and pagination strategies and
a namespace service (used to look up tokens). The resulting object is passed
to af_fetch() and af_fetch_all().
Usage
af_api(
endpoint,
service = "apifetch",
auth = af_auth_bearer(),
pagination = af_paginate_offset(),
drop_cols = character(0),
connect_hint = NULL
)Arguments
- endpoint
The base API URL.
- service
Namespace used to look up the token (see
af_get_token()).- auth
An
apifetch_authstrategy (see af_auth). Defaultaf_auth_bearer().- pagination
An
apifetch_paginationstrategy (see af_paginate). Defaultaf_paginate_offset().- drop_cols
Character vector of response columns to drop after parsing (e.g. a status column). Default none.
- connect_hint
Optional extra line shown when a connection error occurs (e.g. a VPN requirement).
Examples
af_api(
endpoint = "https://www.bigdata.pe.gov.br/api/buscar",
service = "BigDataPE",
auth = af_auth_raw(),
pagination = af_paginate_offset("header"),
drop_cols = "Mensagem",
connect_hint = "Ensure you are on the PE Conectado network or VPN."
)
#>
#> ── <apifetch_api>
#> • endpoint: <https://www.bigdata.pe.gov.br/api/buscar>
#> • service: "BigDataPE"
#> • drop_cols: "Mensagem"