开发者

How to use a public API? [closed]

开发者 https://www.devze.com 2023-04-01 13:06 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. 开发者_Go百科 Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.
开发者_Go百科

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

Improve this question

I'm a pretty amateur programmer and i need more coding that is not related to school. I live in the bay area and came across the Bay Area Rapid Transit's API. But their documentation sucks! I want to build a simple webpage that uses the bike flag (seen here: http://api.bart.gov/docs/sched/stnsched.aspx) to display when someone can bring their bicycle on the subway. I've never used an API before so i'm pretty lost. I've written simple programs with c++, java and python.

how should i get started? What languages are good? What would this simple web app look like?

Thanks for any help!


Their documentation isn't too bad. If you are thinking about getting into programming professionally, prepare for bad documentation, and documentation far worse than this.

Basically, BART will give you an XML file of data via a URI. The query string of the URI is acting as input parameters. This is their URI in their example:

http://api.bart.gov/api/sched.aspx?cmd=stnsched&orig=12th&key=MW9S-E7SL-26DU-VV8V&l=1

The bold parts of the URI indicate the parameter names as you can see in your documentation. The italics part indicates the value of that parameter. So we see:

  • cmd = stnsched
  • orig = 12th
  • key = MW9S-E7SL-26DU-VV8V

Changing these values in the URI will yield different results in the XML file (except for key, I think. This appears to be a registration process for using the API).

Now, as far as language - use whatever you feel comfortable with. XML is a fairly universal data type. C#, Ruby, Java, Python, etc all have excellent ability to work with XML with their given Framework (Like the .NET Framework BCL for C#). There are many other languages as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消