Skip to contents

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_auth strategy (see af_auth). Default af_auth_bearer().

pagination

An apifetch_pagination strategy (see af_paginate). Default af_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).

Value

An apifetch_api object.

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"