Use httr::GET()
to make a request to the WMATA API and return the parsed
list from the JSON data. The function uses httr::RETRY()
, so the call will
repeat up to three times if there is a failure (often from a rate limit).
wmata_api(path, query = NULL, ..., level, api_key = wmata_key())
The path to an API endpoint (e.g., "Bus.svc/json/jStopSchedule")
Additional queries also passed, possibly your key if need be.
Arguments passed to jsonlite::fromJSON()
for parsing.
If parsed JSON is a list, select only this element. Useful if the list is length one containing a data frame or some other object.
Subscription key which provides access to this API. Defaults
Sys.getenv("WMATA_KEY")
via wmata_key()
.
A single JSON string.
This function was modified from 'zamorarr/wmata' on GitHub: https://github.com/zamorarr/wmata/blob/master/R/api.r
if (FALSE) {
wmata_api("Rail.svc/json/jLines", query = list(LineCode = "RD"))
}