Understanding Web APIs
Written by Neil on May 20, 2015
Ok, lets say you’re having dinner at a local pizza restaurant and you overhear a couple (probably developers & techies) talking at the next table; lets call them Jack & Jill. Jill is telling Jack how she has developed a photo search app using the Instagram Web API, but you don’t know what she’s talking about?
You know what Instagram is but you are not sure of the term Web APIs!
What are Web APIs
API stands for Application Programming Interface. An API allows one piece of software to talk to another piece of software.
For example, I was reading the other day about a smart fridge that tracks your Facebook Events. It sees that you’re planning a party, how many people have RSVP’d, then alerts you to make a beer run!! In simple terms: The I in API, the interface in the fridge connects with Facebook and returns information.
Back to Jill – Instagram have created a software program that enables it to exchange information with other software programs, in this instance, Jill’s web application.
Jill’s app allows anyone to search for pictures on Instagram’s database. For example, if you search for pizzas it connects to the Instagram database and brings up images of pizzas or images that have been tagged with the word pizza. If you search for cats, it brings up pictures of cats and so on and so on.
So, this Instagram Web API allows a web application to get information from the Instagram database; without any user knowledge or intervention, and give you back images
APIs are completely invisible to website surfers and software users. Their job is to run silently in the background, providing a way for applications to work with each other to get the user the information or functionality he or she needs.
In layman’s terms
An API is an agreement between two people stating:
“If you give me this instruction, I will perform this action, or return this information.”
Just focus on the I. An API is an interface. You use interfaces all the time. A computer’s operating system is an interface, as are buttons on a TV remote control. Using the pizza restaurant as an example: Jill chooses a 12-inch Margherita pizza from the menu. She then places an order with the waiter. He returns with her pizza. The Menu = the API
It’s an interface that sits on top of a complicated system and simplifies certain tasks, a middleman that saves you from needing to know all the details of what’s happening under the hood. It translates your actions into technical details for the computer system on the other end.
If this Web API was not available
- Jill would have to write the piece of software (the restaurant menu) herself, running the risk of writing it slightly differently and screwing things up.
- She would have to build her own database.
Therefore, Instagram allows anyone to reuse the Instagram API for their own web application, thereby saving them the time and effort of writing the software.
The importance of an API is that it allows programmers to use software they write to communicate with software written by other people. Were this not available, every programmer would have to rewrite every useful bit of every other piece of software out there, again, at the risk of writing it slightly differently and screwing things up.
The API allows them to reuse other people’s programming, thereby ensuring that they always do things the same way as other people do (and saving them the effort of writing the software). So as you can see, Web APIs are game changers, even Microsoft think so.
”In the world of cloud computing, API’s are the NEW currency”
– S.Somasegar, VP of Microsoft’s developer division.
The reason this is such a big deal is because it’s an open Web API economy; meaning that anyone can build API’s or use APIs. You can also build web apps that use a mix of Web API’s, for example you can combine location APIs with targeted promotions or you can map your morning run with a calorie counter!
Getting started
The Good News!
Every API has a developer page which gives you instructions on how to get data.
- You don’t have to be a coding expert!
- What they want you to do is sign up to their developer website and register your app.
- In most cases you need 3 things: A Client id, a Secret code, an Access code
Registering your app
so lets say you wanted to develop a similar app to Jill then you would go to the Instagram developer page http://instagram.com/developer/ and sign in to you Instagram account. On the right hand side click on the register a new client.
API Limits
There is a limit to how many API calls your application can make. API calls are basically requests for information, in Jill’s case – search requests
For example, Instagram supports a large number of applications and serves billions of API calls every month. To maintain a high level of availability and provide a superior quality of service, Instagram limits API call usage. The limits on the total calls and the rate at which the calls can be made depend on the service.
Many APIs include limits on how many requests you can make per hour or per day in order to prevent you from overloading their servers. If you aren’t a programmer, these limits probably won’t be an issue.
The limits are there to prevent you from automating a flurry of thousands of requests.
For information on rate limits, see a particular API’s documentation. Note also that lots of APIs are free up to a certain rate limit and then charge you money if you want to exceed it.
Growth
Web APIs are a big part of the web. According to the Programmable Web – The leading source of news & information about APIs, there were over 10,000 APIs published by companies for open consumption in 2013. That is quadruple the number available in 2010.
Conclusion
When it comes to Web APIs, there are millions to choose from. It’s such a massive topic at the moment; and you have probably used Web APIs without even knowing it.
A Web API is simply a software program that uses the internet to allow websites, web applications, mobile applications and other devices to communicate and share information with each other.
APIs are part of every aspect of our increasingly digital lives. They provide the connectivity everyone needs from the smartphone to all the tools you use at the office, and in our home security, appliances, and entertainment
Regards
Neil @neilp666
p.s
Want to learn more about APIs? check out this new guide build a Ruby on Rails Web application using the Instagram Web API!
use neil5 for $5 off