Skip to contents

If you use this function, please open an issue in the youtubeR GitHub repository describing your use case. We intend to wrap all endpoints such that this function will not be necessary for users.

Usage

yt_call_api(
  endpoint,
  query = NULL,
  body = NULL,
  method = NULL,
  client = yt_construct_client(),
  cache_disk = getOption("yt_cache_disk", FALSE),
  cache_key = getOption("yt_cache_key", NULL),
  token = NULL,
  base_url = c("basic", "upload", "resumable_upload")
)

Arguments

endpoint

The path to an endpoint. Optionally, a list with the path plus variables to glue::glue() into the path.

query

An optional list of parameters to pass in the query portion of the request.

body

An optional list of parameters to pass in the body portion of the request.

method

If the method is something other than GET or POST, supply it. Case is ignored.

client

A YouTube OAuth client created with yt_construct_client().

cache_disk

Should the access token be cached on disk? This reduces the number of times that you need to re-authenticate at the cost of storing access credentials on disk. Cached tokens are encrypted and automatically deleted 30 days after creation.

cache_key

If you are authenticating with multiple users using the same client, use this key to differentiate between those users.

token

A YouTube API OAuth token, or the access_token string from such a token. We recommend that you instead supply a client, in which case an appropriate token will be located if possible.

base_url

Which family of URLs to use. Almost everything will use the default basic URL.

Value

The result of the call.