Skip to contents

Export endpoints are primarily used for sharing. A user can specify a request with filters, includes, and appends the data will then be collected and stored. A link will be provided to the user so they can securely share the data with others.

Usage

api_export(
  api_name,
  endpoint,
  format = c("csv", "json", "parquet"),
  parameters = list(),
  filters = list(),
  decorate_filters = TRUE,
  includes = NULL,
  valid_includes = NULL,
  appends = NULL,
  valid_appends = NULL,
  pages = list(),
  dry_run = FALSE,
  verbosity = 0,
  timeout = 300
)

Arguments

api_name

the name of the API to call

endpoint

the API endpoint to make the request to

format

the format of the file to be exported. Must be one of 'csv', 'json', or 'parquet'

parameters

a named list of query parameters to pass to the request, see the lookups endpoint for an example

filters

a named list of filters (i.e. key-value pairs) to apply to the request

decorate_filters

Logical, default TRUE, adds the word filter and square brackets to the query string. For Plumber APIs set to FALSE.

includes

a character vector of relationships to include in the response these are data from other tables or resources

valid_includes

a character vector of valid includes to check against

appends

a character vector of dynamically created values to append to the response

valid_appends

a character vector of valid appends to check against

pages

a named list of page arguments, common choices are size, number, and omit

dry_run

if TRUE, the call is printed to the console instead of being sent to the API, which is useful for debugging

verbosity

How much information to print to the console. Defaults to 0.

  • 0: no output

  • 1: show headers

  • 2: show headers and body

  • 3: show headers, body, and curl status messages

timeout

request timeout in seconds (default is 300)

Value

An httr2 response object.

See also

api_get() for standard queries, parse_url() to display export details, parse_url2df() to download and parse the export

Examples

if (FALSE) { # \dontrun{
resp <- api_export("counts", "surveys",
  format = "parquet",
  filters = list(project_id = 1)
)
parse_url(resp)
} # }