View source: R/request_generate.R
request_generate | R Documentation |
Build a request, using knowledge of the Drive v3 API from its
Discovery Document
(https://www.googleapis.com/discovery/v1/apis/drive/v3/rest
). Most users
should, instead, use higher-level wrappers that facilitate common tasks,
such as uploading or downloading Drive files. The functions here are
intended for internal use and for programming around the Drive API.
request_generate()
lets you provide the bare minimum of input.
It takes a nickname for an endpoint and:
Uses the API spec to look up the path
, method
, and base URL.
Checks params
for validity and completeness with respect to the
endpoint. Separates parameters into those destined for the body, the query,
and URL endpoint substitution (which is also enacted).
Adds an API key to the query if and only if token = NULL
.
Adds supportsAllDrives = TRUE
to the query if the endpoint requires.
request_generate(
endpoint = character(),
params = list(),
key = NULL,
token = drive_token()
)
endpoint |
Character. Nickname for one of the selected Drive v3 API
endpoints built into googledrive. Learn more in |
params |
Named list. Parameters destined for endpoint URL substitution, the query, or the body. |
key |
API key. Needed for requests that don't contain a token. The need
for an API key in the absence of a token is explained in Google's document
"Credentials, access, security, and identity"
( |
token |
Drive token. Set to |
list()
Components are method
, path
, query
, body
,
token
, and url
, suitable as input for request_make()
.
gargle::request_develop()
, gargle::request_build()
Other low-level API functions:
drive_has_token()
,
drive_token()
,
request_make()
req <- request_generate(
"drive.files.get",
list(fileId = "abc"),
token = drive_token()
)
req
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.