powered by
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).
httr::GET()
httr::RETRY()
wmata_api(path, query = NULL, ..., level, api_key = wmata_key())
A single JSON string.
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.
jsonlite::fromJSON()
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().
Sys.getenv("WMATA_KEY")
wmata_key()
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")) }
Run the code above in your browser using DataLab