View source: R/get-rest-resource.R
get_rest_resource | R Documentation |
This function is intended for developer use. It makes it easy to quickly generate vectorised calls to the different APIs.
get_rest_resource(
...,
language = "en",
api = c("core", "wikimedia", "wikimedia_org", "xtools"),
response_format = c("json", "html"),
response_type = NULL,
failure_mode = c("error", "quiet")
)
... |
< |
language |
Character vector of two-letter language codes |
api |
The desired REST api: "core", "wikimedia", "wikimedia_org", or "xtools" |
response_format |
The expected Content-Type of the response. Currently "html" and "json" are supported. |
response_type |
The schema of the response. If supplied, the results will be parsed using the schema. |
failure_mode |
How to respond if a request fails "error", the default: raise an error "quiet", silently return NA, and include the http error code in the response |
The key invariant to maintain is the number of rows. Users ought to be able to use this function with dplyr::mutate, which requires the number of rows to be invariant.
A list of responses. If response_format
== "json", then the responses
will be simple R lists. If response_format
== "html", then the responses
will xml_document
objects. If response_type
is supplied, the response
will be coerced into a tibble::tbl_df or vector using the relevant schema.
If the response is a 'scalar list' (i.e. a list of length == 1), then it is
silently unlisted, returning a simple list or vector.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.