wmata_key {metro} | R Documentation |
Find a WMATA API key
Description
All calls to the WMATA API must be accompanied by a personal API key. A free key can be obtained by subscribing to the default tier:
Sign up for a free WMATA developer account: https://developer.wmata.com/
Log in and subscribe to the free default tier.
Copy the primary or secondary key from your profile.
Pass your API key to a function through one of three ways:
Use
Sys.setenv()
to temporarily set defineWMATA_KEY
.Pass your key as a string to the
api_key
argument of any function.Store the the WMATA key as a line like
WMATA_KEY=xxxyyyzzz
in your.Renviron
file, to be called bywmata_key()
viaSys.getenv()
.
The WMATA also provides a demonstration key. This key should never be used in production applications, it is rate limited and subject to change at any time. The key can be found on the WMATA products page when not signed into a developer account.
The wmata_validate()
function can be used to verify a key is valid.
Usage
wmata_key(api_key = Sys.getenv("WMATA_KEY"))
wmata_validate(api_key = wmata_key())
Arguments
api_key |
Subscription key which provides access to this API. Defaults
|
Details
Default tier sufficient for most casual developers. Rate limited to 10 calls/second and 50,000 calls per day. This product contains 8 APIs and all APIs needed for the functions in this package:
Bus Route and Stop Methods
GTFS (unused)
Incidents
Misc Methods
Rail Station Information
Real-Time Bus Predictions
Real-Time Rail Predictions
Train Positions
Value
For wmata_key()
, a 32 character alphanumeric API key. For
wmata_validate()
, either TRUE
for a valid key or an error if invalid.