Skip to contents

Perform a request to an API endpoint

Usage

api_perform(req, dry_run = FALSE, verbosity = 0, timeout = 300)

Arguments

req

a request object

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

a response object

See also

api_get(), api_post(), api_patch(), api_delete() which call this function internally

Examples

if (FALSE) { # \dontrun{

httr2::request("https://counts.spdgt.com/api/me") |>
  api_perform()
} # }