Sep 14, 2009

APIs

All of the talk about APIs and Mashups in our first class intrigued my curiosity quite a bit. While I've heard of APIs before, I have never actually used one. Obviously, my lack of knowledge about APIs means I have even less knowledge about the closely related Mashups we also discussed. Since Michelle already posted about Mashups, I thought it would be helpful to take it back a step further and post about APIs. I'm sure there are at least a few other people in this class which don't know a lot about APIs, like myself, so I figured a little research on the topic would be beneficial to many of us. The first thing I wanted to do was get a definition of APIs in order to try and understand them better.

As stated on Wikipedia.org and supported by the Free On-Line Dictionary Of Computing (foldoc.org), Pc Magazine (PCMAG.com), and computerworld.com, an Application Programming Interface (API) is "an interface in computer science that defines the ways by which an application program may request services from libraries and/or operating systems." The first thing I realized after reading this definition was that APIs are not limited to the Web. Being that our class is Web focused, and considering that Professor Drake specified them as Web APIs when he discussed them, it's safe to say that our focus will probably be on the Web APIs. Applying this definition to the Web APIs works, but re-wording it a little bit makes it more applicable to Web terms. Web APIs are indeed still an interface in computer science, but more specifically, they are a "set of Hypertext Transfer Protocol (HTTP) request messages." HTTP messages are things we encounter every day while using the Internet, even though we never actually see them happen. HTTP requests are most commonly used in the Head sections of Websites, as well as the common PHP functions "GET" and "POST" and five other less common methods. In Web APIs, these request messages are defined along with some sort of structure, then commonly expressed in XML or JSON format. Web APIs can then be combined together, bringing multiple services into one platform, and forming Mashups. This process of message requests and XML and JSON all sounds rather similar to the process AJAX uses, but my limited knowledge of AJAX could mean I'm completely wrong about this.

Now that we've got a solid definition of what an API is, the next step in understanding them is to begin exploring different examples. One of the most popular Web APIs being used these days (based on statistics provided by programmableweb.com) is the Google Maps API. This API that Google provides, allows you to embed the popular "Google Maps" service right into your own Web pages. With a little bit of javascript, the Google Maps API can be used just like Google's map service is offered on their Web page. The maps can be edited and adjusted in many different ways, allowing you to create detailed maps applications on your site like the following example Google uses to promote this API on their site.




One of the best parts of most APIs, including the Google Maps API, is that they are free of charge! Free stuff is always good!

4 comments:

  1. Matt,
    While you don't need to use AJAX to access web APIs, it comes in very handy. As we will see, accessing web services through their APIs must be done from the server unless the web service originates from your own server. Complex I know. But I'll explain more as the semester progresses.

    ReplyDelete
  2. Interesting, I look forward to getting a grasp of all this!

    ReplyDelete
  3. Good post Matt. I have to admit that the whole time Prof. Drake was talking about APIs, I was trying to think of what it might mean and how it relates to using AJAX which of course I don't know anything about yet. At the end I gave up and googled it in class. And I agree Prof., that does seem complex and I really hope I get a good foundation in this subject by the end of the semester.

    ReplyDelete
  4. Thank you for the post. I was beginning to think I was the only one that didn't quite understand what API's were or how they worked. This has really helped me to understand it better and I don't feel so alone.

    ReplyDelete