Skip to contents

Small helper function to handle http requests to the API.

Usage

API_GET(
  URL,
  config = NULL,
  query = NULL,
  expected_class = NULL,
  verbose = FALSE
)

Arguments

URL

the URL to be called.

config

NULL or list, forwarded to httr::GET.

query

NULL or list, forwarded to httr::GET.

expected_class

NULL or character vector. If set, it is checked if the returned object is of this class. If not, a warning will be thrown (no error).

verbose

logical, shows some additional information if TRUE.

Value

Returns the object we get from httr::content() after a successful API call. If an error is detected, an error with additional details will be displayed.

Author

Reto Stauffer