A wrapper to the get_api_data method defined in the Credentials, Token, and Apikey classes.

get_api_data(url, fromCSV = FALSE, profile = myProfile, ...)

Arguments

url

a character of API URL.

fromCSV

a logical, defines whether data are returned in .csv format or .json format.

profile

an object of class Auth. Default is myProfile.

...

further arguments and CSV parsing parameters to be passed to read_csv when fromCSV = TRUE.

Value

a dataframe (fromCSV = TRUE) or a list containing a dataframe and its metadata (fromCSV = TRUE).

Examples

if (FALSE) {
myProfile <- create_profile("", "")

json_url <- "http://httpbin.org/json"
api_data_json <- get_api_data(json_url)
head(api_data_json$slideshow$slides)

csv_url <- "http://httpbin.org/robots.txt"
api_data_csv <- get_api_data(csv_url, fromCSV = TRUE)
head(api_data_csv)
}