How to use online APIs - a starting point
As mentioned in my last post I am interested on where to start developing with online APIs. I did some research and found a few starting points that I wanted to share.
Helpful tools
There are several tools to test and play with APIs, one of them is apigee – a tool For people who love APIs. They offer an online console to access APIs, among others they offer access to Etsy, Facebook, twitter and SimpleGeo. As SimpleGeo is on the list of APIs of interest to me I started using the console to access the API. Before doing that I signed up for an Oauth key – needed to authenticate a request to their servers. Using apigee is pretty nice:

As you can see on the screenshot, the SimpleGeo API is selected (you can select any API you wanna test from the dropdown menu). The lock on the left side of the URL enables you to add your authentication credentials (for OAuth or basic authentication). The gear wheel to the right of the URL enables you to add more/optional headers to your request. So what could one find interesting in the SimpleGeo API?
- Features (real world features such as businesses, regions, etc.)
- Context (Context as in weather, demographics, or neighborhood data)
- Places (Searching for places nearby)
The result of the above shown request to the context endpoint of the SimpleGeo API gets us information about the current weather or the legislative district of the given address. As far as I know using the address so far only works with US addresses. Feel free to try it out yourself, you can not break anything when using the console.
Another helpful tool is hurl which makes HTTP requests. It was developed during the rails rumble 2009 and was also released as an Open Source project on Github. hurl is like a web frontend for curl – the command line tool for transferring data with URL syntax. You can use hurl not just to test APIs, but also use it to test websites. To demonstrate how it works take a look at the video:
>
Conclusion
Both websites help you test, debug and play around with API before you actually start developing something using a programming language. Most APIs enable you to choose in what format you want to receive the response of your request:
- For XML:
http://vimeo.com/api/v2/video/12132621.xml
- For JSON:
http://vimeo.com/api/v2/video/12132621.json
The format you choose is totally up to you and also depends on the programming language and libraries you choose. To change the response format just choose the corresponding filetype in your request.
Please let me know if you found this post helpful or if you have any additions/corrections.









blog comments powered by Disqus