Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3619

How to use the Washington, DC Metro API

$
0
0

I've been researching how I can take the transit info API that The Washington DC Metro Rail offers, and display it as HTML.

The documentation is on their web site, but It does not include many examples. The only instructions I've found is to use one of three URLs.

I have figured out how to see the information using the below code. The problem is that the URLs below are generating all data as text only in my browser. I cannot figure out how to display selected data as HTML.

From their site:

Each method has 2 endpoints: REST and JSON.

URL (REST) example:api.wmata.com/StationPrediction.svc/GetPrediction/A10?api_key=YOUR_API_KEY

URL (JSON) example: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 ofcallback]

When using JSONP make sure that [name of callback] in the URLdisplayed above is the name of a Javascript function needed to processthe JSON data.

Can anyone point me in the right direction for a tutorial or best way to get started?


Viewing all articles
Browse latest Browse all 3619

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>