You must have heard programmers talk about API’s in relation to your app talking to other apps. API’s stand for Application programming interface. As the name suggest it is a medium for two applications to communicate.
An app A’s API helps app B to talk to A. So B does not have to worry about underlying implementations in A. It would ask A to do some work and return data and does not have to worry what A does behind the screen.
When do you use an API?
If your app needs some information or use some functionality of other app, it needs to use that app’s API. So if your application needs information about user’s Facebook Profile it would use Facebook API; If your application needs list of Places it would use Google Places API; If your app wants to save a file to user’s Dropbox account, it would use Dropbox API.
When do you create an API for your own app?
If you want to open your app’s data or functionality for other apps, you would create your own API’s. For instance, if your app is about coupons, you can create an API where other apps can request you coupon codes; Travels and Hotel booking apps (Expedia, MakeMyTrip, Cleartrip) have API’s for aggregator apps (Trivago,Tripadvisor) which brings more business to them.
Private, Partner and Public APIs
Private API is only available within a company.
Protected API is only available to strategic partners and not to public. e.g. Facebook Public Feed API is available only to set of media publishers. For protected API’s you would have to approach the API provider and get approval with them before using them.
Public API is available to use for everyone e.g Facebook Graph API, Google Maps API etc.
Whenever an API is created for an app, it is provided with a documentation which tells a programmer how they can use that particular API. What are the inputs that needs to be provided and what are the possible outputs/responses that would be returned.
API Simple Example
Here is an example of wikipedia api,
Wikipedia says send a request to url “https://en.wikipedia.org/w/api.php” with parameters “action”, “titles” and “format”.
action-query and title-medium will query/search for wikipedia articles titled “Medium” and format-json tells in which format does the api return the data.
When you click on this it url, it returns following output –
where you can use pageid to construct the wiki article url — https://en.wikipedia.org/?curid=19967
You can play around by changing the word “Medium” in the url to any random words e.g. “Facebook” (https://en.wikipedia.org/w/api.php?action=query&titles=Facebook&format=json)
API’s make is possible for us to reuse functionality from other apps so that we don’t have to build it from scratch. For instance, because of Google Maps API’s we don’t have to invent our own maps. If you have any questions, please feel free to leave a comment.
If you like this article please do share and recommend it to anyone who would benefit from this. About me, I am a programmer with over 6 years of experience. I have worked with and for multiple Startups. I am part of Adevole — Your Technical Co-Founder, it’s basically a group of programmers dedicated towards getting technology right for startup. You can know more about me @ www.vishweshshetty.com