get_api_data: Get API data

View source: R/api_utilities.R

get_api_dataR Documentation

Get API data

Description

A wrapper to the get_api_data method defined in the Credentials class.

Usage

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 Credentials. 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).

See Also

Credentials

Examples

## Not run: 
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)

## End(Not run)

CDCgov/Rnssp documentation built on May 12, 2024, 1:32 a.m.