- Previous:
- Up:
- Next: Method 1: Rail Lines
Description of Methods
The following methods describe the Metro Rail system:
- Lines - Returns Metro lines.
- Stations - Returns the list of Metro stations.
- Station Info - Returns information about individual Metro stations.
- Path - Returns a path of stations between two stations.
- Station Prediction - Returns station arrival information as it appears on Public Information Displays.
- Rail Incidents - Returns incident information as it appears on the Public Information Displays.
- Elevator Incidents - Returns information about elevators and escalators as it appears on the Public Information Displays.
- Station Entrances - Returns entrances to Metro stations.
- Bus Routes - Returns the list of all bus routes.
- Bus Stops - Returns the list of all bus stops.
- Bus Schedule by Route - Returns schedule for the route.
- Bus Route Details - Returns shape of the route (locations the bus is going through) and its bus stops.
- Bus Positions - Returns real time bus positions.
- Bus Schedule by Stop - Returns schedule for the stop.
- Bus Prediction - Returns the bus arrival predictions for a specific bus stop according to the real-time positions of the buses.
Each method has 2 endpoints: REST and JSON.
URL (REST) example: http://api.wmata.com/StationPrediction.svc/GetPrediction/A10?api_key=YOUR_API_KEY
URL (JSON) example: http://api.wmata.com/StationPrediction.svc/json/GetPrediction/A10?api_key=YOUR_API_KEY
Additionally, developers can use JSONP if desired by adding a "callback" parameter to the JSON call:
http://[url to JSON service]?api_key=[your_key]&callback=[name of callback]
When using JSONP make sure that [name of callback] in the URL displayed above is the name of a Javascript function needed to process the JSON data.
- Previous:
- Up:
- Next: Method 1: Rail Lines
Docs Navigation
- Description of Methods
- Method 1: Rail Lines
- Method 2: Rail Stations
- Method 3: Rail Station Info
- Method 4: Rail Paths
- Method 5: Rail Station Prediction
- Method 6: Rail Incidents
- Method 7: Elevator / Elevator Incidents
- Method 8: Station Entrances
- Method 9: Bus Routes
- Method 10: Bus Stops
- Method 11: Bus Schedule by Route
- Method 12: Bus Route Details
- Method 13: Bus Positions
- Method 14: Bus Schedule by Stop
- Method 15: Bus Prediction
55 Comments
RamonaW – 1 year ago
Web API Documentation Best Practices <http://blog.programmableweb.com/2010/08/12/web-api-documentation-best-practices/> suggests (among other things) that you should
'Show Example Requests and Responses
In addition to sample code, having HTTP, XML, and JSON samples of your request and response is important. However, samples only are not sufficient. In addition, you need a description that explains the purpose of the call and you need a table that explains each element. We recommend a table with columns for Name, Type, Description, and Remarks.
Although the Type column provides most of the information you need regarding format, the remarks section may need to specify further. If an XML element is a date, you should specify the format of the date. If it’s a time, then you need to specify its time-zone."
Wmata Admin – 1 year ago
RamonaW: Thanks for the thoughtful suggestions. We will be beefing up the documentation in the near future and will consult the Best Practices doc that you linked to for guidance. Thanks - Bill
Bold, Inc. – 1 year ago
Does the WMATA API currently support JSONP? (http://en.wikipedia.org/wiki/JSON#JSONP) If not, would you consider enabling it?
Peter Shashkin – 1 year ago
We thought about it, and I believe if we have demand for it we should definitely go for it. At this point our priority is to expand range of services rather than providing additional formats. When we release bus information we should consider jsop, but I cannot provide eta at this point
Bold, Inc. – 1 year ago
Thanks for the response and I appreciate the future consideration and I'm sure there will be quite a few developers who will use the JSONP option.
I just wanted to send along a blog post from Mashery demonstrating some example code for enabling JSONP with PHP in just a couple lines. (The code is very simple and could easily be written in your language of choice if it is not PHP).
They also mention the possibility of a service to enable JSONP with a simple configuration change in your Mashery account, though I don't know if they have actually implemented that change.
http://support.mashery.com/blog/read/New_Feature_JSONP_Error_Sets
Thanks!
Bold, Inc. – 1 year ago
We have just launched our app http://nextmetro.com and it seems that it has gained enough popularity in a day or so and we have already hit our API rate limit. Is there someone I can contact about an API rate increase for the key we use on our "NextMetro" app? We are caching what we can, but are relying heavily on train predications which change rapidly, so we only cache each train predication call for 20 seconds.
Thanks for your help!
Wmata Admin – 1 year ago
Bold-Inc. - We have upped the rate limit for your app per your request.
Bold, Inc. – 1 year ago
Thanks for the rate limit help!
One thing I noticed tonight:
JSONP appears to be enabled now by default. I'm thrilled that JSONP is operational but it is now on by default even when not specifying a callback function. (if no callback function is specified it wraps the response in "callback()"). That will break any app that is currently expecting regular JSON from the JSON requests. Can you alter the code to only enable JSONP when the callback query parameter is present? Thanks!
perdog – 1 year ago
I can confirm the issue that Bold, Inc. Mentioned above. My iPhone app is now broken and not working because of this change!
While I am expecting JSON, Everything is all of a sudden wrapped in a Callback() function that is breaking my application.
Was this intentional or a mistake?
I hope it was a mistake and you can fix it quickly. As you may know, it takes over a week to get an update through the Apple app store.
Thank you for your help!
Peter Shashkin – 1 year ago
This was mashery adapters update issue. Should be fixed now - let us know if you still having problems
perdog – 1 year ago
Hi all,
First off, big thanks for making this API available. 2 quick questions:
1. What's the best way to get in touch with the development team if something like the JSONP issue happens again? This comment board? Facebook? An email address? Everything is great now, but just wondering.
2. Is there a method to check how many API requests my API key has been used for in a day - and of course how many are remaining?
Thanks
Madhvi – 1 year ago
Hi all, I have been trying to get Rail Station Prediction for station 'Metro Centre (id A01). using REST API from following link.
http://api.wmata.com/StationPrediction.svc/GetPrediction/A01?api_key=<Public Key> and I am getting information for group 1 and 2.
But, when I try to varify the XML content with the information displayed on webpage on following URL:
http://www.wmata.com/rider_tools/pids/showpid.cfm?station_id=1 , I can see some extra destinations in Group 3 and 4 which are not there in the XML of REST API.
Can anyone help me and guide me about what am doing wrong? and what should I do to get complete information.
Thanks
Peter Shashkin – 1 year ago
perdog -
1) Unless you need to send a private note, this place would be best because it is monitored by multiple poeple
2) If you dont see any reports in your interface, you probably dont have this ability. But I can see stats in admin mode.
Madhvi - I need to check something and will get back to you tomorrow probably
Peter Shashkin – 1 year ago
Madhvi, we reveal you more truth than other system, and that introduces some confusion :)
Metro Center is one station from your standpoint, but two stations from ours, because Metro Center has two codes. each has two groups.
Rider tools present it as single station with 4 groups, we present it as two stations with 2 groups each.
Haisam – 1 year ago
When will buses be included in this API?
Haisam – 1 year ago
The API implies that REST by definition returns XML, while this is not the case. There should be a variable, perhaps called, format=xml or format=json which returns the data in the desired format. This would be more consistent than creating a /json/ "path"
Peter Shashkin – 1 year ago
Haisam
1) Buses - we dont have exact date yet. This should be end of October - beg. of November approximately
2) Terminology and call parameters can coexist without any problems. For example, we can call our JSON calls "type=spaceship", and it would still work :) But seriously, changing anything at this point is not a very good idea anyway since people started using this API. Using /json/ path was more convenient for us, since we were using so many proxies and we did not want to complicate our lives
Haisam – 1 year ago
Peter:
Thank you for your reply and look forward to the bus API. I understand your concern for changing things at this moment.
sahar – 1 year ago
I downloaded Metrobus stops data on http://www.wmata.com/rider_tools/license_agreement.cfm. some latitude and longitude of bus stops does not seem accurate. For example, two different bus stops on different side of a road have the same latitude and longitude. Is there any other accurate data available?
Thank you very much for your help.
Peter Shashkin – 1 year ago
Sahar, I recommend not to use that link, since it contains outdated and inaccurate info. We plan to release a bunch of bus services end of October \ beg of November, which will contain very good bus stops info.
sahar – 1 year ago
Thank you Peter for your reply.
Tim Schmitz – 1 year ago
I've been trying to get in touch with someone about increasing API limits for my upcoming app, but haven't had any luck getting a response from the email address listed in the FAQ. Is there someone else I should contact?
Peter Shashkin – 1 year ago
Tim, please send me details to pshashkin at wmata, we will figure that out
sahar – 1 year ago
the bus stop data do not have stop numbers which is used for "next bus arrival time". could you please tell me how can I have them?
Thanks.
Wmata Admin – 1 year ago
Bus stop dataset is not released yet, and data model is not finalized. We expect that when its final, the output will have info allowing you to tie it to next bus.
Jerry Lukins – 1 year ago
I just registered and got a key and tried to use the call http://api.wmata.com/Rail.svc/Lines?api_key=<Substituted my key here> within internet explorer to see the response and I got an HTTP 403 Forbidden error, Am I missing part of a registration step or something?
Wmata Admin – 1 year ago
What is your key? you can email it to pshashkin%wmata:com, I can check
Jeromy French – 1 year ago
I have sifted through each of the methods, and the GTFS documentation, but I can't determine how to retrieve fare information (per trip) from the available datasets. I see in the GTFS documentation that this information would be included in the fare_attributes method, which is not (currently?) available from WMATA. Is there another way to determine the price of a trip between points A and B at a specified time/date?
Wmata Admin – 1 year ago
In our methods, we don't have any fare information, but we will check if we can make a service.
Jeromy French – 1 year ago
Thank you--that might be very helpful particularly to all those companies (and government agencies) that have to verify commuting costs in order to provide metro benefits.
greatrat00 – 1 year ago
Firstly, thanks for opening up the data!
My question is the following:
It seems that to get an estimate for how long it will take for the next buses to reach a particular stop two steps are involved:
1) Look at the next scheduled tripID with the Bus Schedule by Stop method
2) Look at the deviation parameter of that tripID with the Bus Positions method
3) Do the math/algorithm ourselves to get the arrival predictions
Is there any easier way to get it that I'm missing? WMATA already does the prediction computation, testified by the Bus Predictions app on your web page; can you open up a method that shoots that out directly; that is, if it's not being done already and I'm missing it.
Thanks,
Adam
Wmata Admin – 1 year ago
Adam,
Everything you say is correct with the exception of this statement "WMATA already does the prediction computation". This is external service called NextBus. They do this calculation, and even the app is hosted by them, not by WMATA.
At this moment nextbus prediction data is stored externally, and we dont have direct access to it. This is just a beginning, we plan to provide more services in the future, including prediction info from nextbus.
Alex – 1 year ago
Is there a way to calculate minutes it might take me to get from one station to another one?
greatrat00 – 1 year ago
Hi Admin,
Thanks for your prompt reply.
I want to make sure I got this straight...
If I do the three steps I described above will I get something close (or same) as the NextBus Predictions? If you already compute the deviations, that implies you have some sort of prediction right? Would your next step be to add the deviation to the scheduled time yourselves and output it?
Thanks,
Adam
Threespot – 1 year ago
The Bus Positions method is currently returning an empty array, is this service currently down?
Thanks for making this data available!
Wmata Admin – 1 year ago
Threespot - should be fixed now
Threespot – 1 year ago
It would be *extremely* beneficial if this method accepted lat, lon, and radius parameters - just as the bus stops method supports - would it be possible to add that capability?
Without being able to filter with those kinds of parameters, if one wanted to update current bus positions as-close-to-realtime as possible, they'd potentially be making repeated calls to this method which, without specifying a routeID, can return up to 600 some records.
Thanks!
Threespot – 1 year ago
(oops, I was referring to Method 13 - Bus Positions in my post)
Wmata Admin – 1 year ago
Threespot: You got it now (Check Docs).
Threespot – 1 year ago
@Wmata Admin: thanks so much!!
Tom – 1 year ago
I would be interested in discussing WMATA's data project in detail to see if Arlington Transit could release the same data. Whom do I contact outside of this forum? Thanks.
Wmata Admin – 1 year ago
Tom, you can check with Bill Rigney:
wrigney at [our domain]
indhiran – 1 year ago
Any idea why the Calendar.txt file is not included in your latest GTFS zip file?
Wmata Admin – 1 year ago
indhiran - currently GTFS provides very limited set of data and it is going to be redone completely. No ETA as of today.
Calendar.txt will be present in new version
jonny.sizlak – 12 months ago
Is there any other way to contact the admins other than comments? My API key hasn't been activated, and it's been two weeks. :(
Wmata Admin – 12 months ago
jonny.sizlak -> you can try now. If you encounetr problem you can contact "pshashkin" - wmata.com.
indhiran – 10 months ago
Any possibility of matching the TRIPID from the Bus Positions RSS feed to the trips.txt file in the GTFS zip File? A typical TRIPID in the RSS feed would be "10326_11", while tripIDs in your GTFS files are of the format "1013". If I cannot use the TripIDs to match the data between the two feeds, is there an alternate option?
woohoo7676 – 10 months ago
Hi, we recently published a metro app called DCMetro, however today calls appear to be returning "<h1>Unable to connect</h1>"
Is this a consequence of hitting the rate limit? If so, could we apply for a higher rate limit? (already emailed pshashkin at wmata.com, if that is the correct address for this request)
Thanks!
daniel – 9 months ago
Hi all, i would like to report a small error in the StationPrediction feed:
for destinationname=destination='Twinbrk' (Twinbrook station), the DestinationCode is empty. It should be most probably 'A13'.
By the way, thanks for a great API!
Jason_McKee – 9 months ago
Can anyone help... having trouble. Always getting a 403 back, with the X-Mashery-Error-Code: ERR_403_DEVELOPER_INACTIVE
Any help would be appreciated...
vasedelen – 8 months ago
Are we able to access neighboring transit data (Arlington, MTA, Fairfax, etc...) or are we only able to access WMATA data?
Thank you for your help.
V,
vasedelen – 8 months ago
A follow up to my first question. I would like to know if WMATAs API, means i would be able to access data from neighboring transit agencies like Arlington, MTA, Fairfax, etc...
or...
am i only able to access neighboring transit agencies through Google Transit feeds? GTFS?
your help is greatly appreciated.
Thank you.
V.
Wmata Admin – 8 months ago
Sorry for late update - we had problems with notifications. From now on, if you have general inquiry, you can use this form http://developer.wmata.com/contact
indhiran - (adding more data to GTFS) - unfortunately GTFS is out of the scope for this initiative. We're covering Web Services only. I know there is a parallel effort on GTFS in WMATA, but I cannot speak for other team.
woohoo7676 - (unable to connect) - do you still have this problem? You can use contact form and we can check from there. No, this is not related to overlimit
daniel - (empty destination) - thanks for the input - will check!
Jason_McKee - please let me know if you still have this problem
vasedelen - most likely, we're going to expose WMATA info only. You may want to check commuterapi.com. They get our feed + they may have other agencies data. And they also have (free?) API
salmansqadeer – 7 months ago
Same problem as Jason - constantly getting a 403 error.
Mailed you guys and sent my details through the contact form - hope to hear from you soon - This was working fine till last night so this is a major kink in my development process!
noahplusplus – 1 month ago
Hi there. Any progress on getting fare information into the API? If not, I would be delighted if you provided us with something like a CSV-formatted fare chart. (It's not as if fares change so frequently that we need that data in realtime anyway!)
Please sign in to post a comment.