An api is an interface which helps in automation of things. It’s basically a software program that helps to connect the server and the client applications and automate the exchange of data between them. It provides interaction between two softwares but not the user.
An api can be visualized as a waiter in a restaurant who helps in the exchange of data(food) between the client(customer) and the server(the restaurant kitchen).
Taking a technical example, an api is a program that takes in data from the client, delivers it to server and takes the processed data back to the client. Suppose we have a java servlet residing inside a server. Whenever a client application requests for some data the api takes this request, gives it to the java servlet and brings back the processed data to the client. Another simple example is JDBC api in java or the famous Twitter api.
As simple as it may look, an api is a collection of numerous functions or sub-routines working together in harmony. The processed data delivered by the api to the client is in the form of an XML or JSON object. Api’s are mainly used in web services and helps in simplification of data.
Apart from exchanging data, API’s also help in automation of services. Eg:- Sending messages on what’s app or Instagram, making tweets on twitter or searching for a profile on Facebook. Taking a more custom example, suppose we have a database of 50 phone numbers and we need to send the same text message to all the 50 contacts.
Doing it manually takes a lot of effort but if we design a simple REST or SOAP api, then the api will automatically fetch the data from the repository and send the message to all 50 contacts, one by one.
Types of API
Api’s can be of many types depending upon their usage and licensing. Broadly classifying, web api’s are of four types:-
1. Open Api’s (open-source, freely available and used
2.Partner Api’s (Specify rights are needed to use them0
3.Internal Api’s (used for internal systems or inside a company and are not available.)
4.Composite Api’s (used to combine various data and service api’s).
A web service is a system that uses a URL or an address on the World Wide Web to provide access to its service. Apart from the above-mentioned web api’s, we have some service api’s which are as follows:-
Out of the above api’s, SOAP and REST are the ones which are used the most in industries with REST being a newer concept then SOAP.
Rest or Representational State Transfer is a web service api which is used a lot in industry. Rest is a service that uses HTTP requests to GET, PUT, POST and DELETE data. Further, REST is used for building api’s which helps us to interact with cloud services. Most importantly, REST can return data to a client in any form (XML or JSON) and can handle multiple requests.
REST is a concept which is implemented using a Jersy project or Spring and Maven in java or by using flask in Python etc. REST is an architectural style which defines a set of rules used for creating web services. REST api’s are build on the server and they allow the client to talk to the server and request for the required data.
Rest is a very powerful concept and provides interoperability between the systems and the internet. With the increase in demand of API’s in the world, REST is sure to play an important part in connecting various web services so as to ease the exchange and transfer of data and build a better ecosystem between various web services!!.