Web Development

What is an API

So you have learned how to code but is confused about what an API is ? I will first quote the definition of API from wikipedia and then will try to elaborate it in simple words with examples.

In computer programming, an Application Programming Interface (API) is a set of routine definitions, protocols, and tools for building software and applications. A good API makes it easier to develop a program by providing all the building blocks, which are then put together by the programmer. An API may be for a web-based system, operating system, database system, computer hardware, or software library. An API specification can take many forms, but often include specifications for routines, data structures, object classes, variables, or remote calls. POSIX, Microsoft Windows API, the C++ Standard Template Library, and Java APIs are examples of different forms of APIs. Documentation for the API is usually provided to facilitate usage. The status of APIs in intellectual property law is controversial.

Click here to visit the actual wikipedia article 

Not clear yet on what an API is ? Why use an API ? Why websites offers APIs ? Read on :

APIs allow to you make two or more websites communicate with each other to transfer data. The most comonly used APIs are from Facebook, Google and Twitter. Every websites now a days use APIs either from Fabook, Google or Twitter. From now on I will refer tese social sites or any API provider as third-party

Where ?

Have you seen and option Login with third-party ? I am sure you did that is done using an API provided by the third-party. Most of the third-party give out atleast two things for you to communicate with their API :

  • Endpoint
  • API key

An endpoint is the url of the third-party which will give you data if queried correctly. For example youtube might have an api endpoint which may look something like

http://api.youtube.com/v2/search_videos?q=<yourquery>&api_key=<api_key_provided_by_youtube> sending a get request to this url will return some json data.

By integrating third-party API you can allow users to login to your website without using their email and password and without confirming their accounts via email verification because their identity is already confirmed by third-party when they registered on thier website. One advantage of using API is you have plenty of data quickly if you integrate it wisely.

Why websites provide an API ?

Someone on Quora has already answered this question in a very easy to understand language. You can find it here