Introduction To APIs

Profile picture for user devraj

API stands for Application Programming Interface, which acts as a mediator that allows two applications to talk to each other. Each time you use an app like Facebook, WhatsApp, Twitter, or check the weather on your phone, you’re using an API.

An API is a set of definitions and protocols for building and integrating application software. 

APIs let your product or service communicate with other products and services without having to know how they’re implemented. For example, for you e-commerce applications you integrate payment gateway like paypal and any courier apis for delivery services.

An API lists a bunch of operations that front-end developers can use to develop web or mobile application. The front-end developer doesn’t necessarily need to know how API logic is written and in what language or which database API is using to fetch data.

In Industry you will find that back-end developers are writing API in language like Java, Python or PHP and Web Developer and Mobile Developers are calling those APIs using different languages.

Example 1: Login API 

Most of the APIs are same for a single application. For Example: Login API. No matter you are logging in with which device or OS (Laptop, Android, iOS) API is same. User from mobile or Desktop submit credentials, then Server calls API and API then validate the information and return session token.

With a single Login API same user can login on multiple devices. Similarly if you add an item to a cart using desktop browser, you can observe in your mobile application that same item is added automatically. This is because mobile and desktop browser calling same API.

Mobile APIs

Example 2: Flight Booking on Expedia

When you will search for a flight on Expedia, you will find flight information from different airlines, Here Expedia is not airline company but you will still able to search flights from different airlines companies like British airways, Lufthansa or any other company. This is because of the APIs airlines companies allowed Expedia to use.

Now interesting thing, Expedia written their own APIs using different airlines APIs without exposing them directly. 

Other Real world example APIs

  • Google Maps: Google maps API allows your custom app to have access to googles mapping services.
  • Google Analytics: Google Analytics API allows custom dashboards to be built of google analytics data.
  • Twitter API: Twitter API allows 3rd party apps to allow social login using twitter username/password. Or can enable application to have access to twitter tweets data.
  • Facebook API: Facebook API allows connectivity and interaction with Facebook and ability to work with ads, games, payment, login or user data.
  • Social Login: You might have seen in few application where you can login using your gmail, linkedin, facebook or twitter account without creating account an account to that application. This is because gmail, facebook and linkedin exposed their api for public usage.

In real world, you will not see any application which is running without API.