Obtains and parses data from JSON, CSV, and NeXML-returning API endpoints, respectively.

get_json_data(
  url,
  query,
  verbose = FALSE,
  ensureNames = NULL,
  forceGET = FALSE,
  cleanNames = FALSE
)

get_csv_data(url, query, ..., verbose = FALSE, forceGET = FALSE)

get_nexml_data(url, query, verbose = FALSE, forceGET = FALSE)

get_plain_text(url, query, verbose = FALSE)

Arguments

url

character, the URL of the API endpoint to query

query

list, the query parameters and values in the form of a named list

verbose

logical, whether to print message when parsing results

ensureNames

character, which column or list names to ensure are included in the result to be returned. If result returned by the API endpoint does not include them, they will be added, with NA values.

forceGET

logical, whether to force using the HTTP GET method for API access regardless of request length. The default is FALSE, meaning queries exceeding a certain size for transmission will automatically use HTTP POST for accessing the KB API.

cleanNames

for get_json_data, logical, whether to clean names in the returned data replacing "@id" with "id"

...

for get_csv_data, additional parameters to be passed on to read.csv()

Value

For get_json_data, a data frame or list, depending on the result of jsonlite::fromJSON().

For get_csv_data, a data frame.

For get_nexml_data, a nexml object.

Details

These are package-internal functions.