What is an API?

Updated: May 10

API stands for Application Programming Interface. An API is a software intermediary that allows two applications to talk to each other. In other words, an API is the messenger that delivers your request to the provider that you're requesting it from and then delivers the response back to you.







Examples of an API we use in our everyday life:


1.Log-in using XYZ

The way it works is pretty simple. Every time the application loads, it uses the API to check whether the user is already logged in by means of whatever social media platform. If not, when the user clicks the “Log-in Using XYZ” button, a pop-up opens where they are asked to confirm they actually want to log-in with that social media profile. When the user confirms, the API provides the application with identification information, so it knows who’s logging in.


2. Pay with Paypal

When the user clicks the “Pay with PayPal” button, the application sends an “order” request to the PayPal API, specifying the amount owed and other important details. Then, a pop-up authenticates the user and confirms their purchase. Finally, if everything goes to plan, the API sends confirmation of payment back to the application.


3. Searching for hotels


When you go onto a travel site, it may be linked to 10 other travel sites to find the best deal for you. When you input details like California, 2 nights, 1 Room, you send this request to those 10 different travel sites. The API takes your request for that specific location, date range, and room and pings the 10 sites, who send back the deals they have found. You look through the 10 deals and pick the best one. Again, the API is a messenger for your requests.


4. Finding a new restaurant


Let’s say you are traveling to a new city or state. You’ve just dropped everything off at the hotel and decide to grab some lunch. You grab your smart phone and look up restaurants nearby. Quickly you are shown dozens of local restaurants right outside your hotel. Thanks to Google Maps API; they are able to easily display business hours, reviews, phone numbers, and even times they are likely to be busy.


What is REST API ?



A RESTful is an architectural style for an application program interface (API) that uses HTTP requests to access and use data. That data can be used to GET, PUT, POST and DELETE data types, which refers to the reading, updating, creating and deleting of operations concerning resources.


A RESTful API -- also referred to as a RESTful web service or REST API -- is based on representational state transfer (REST), which is an architectural style and approach to communications often used in web services development.


A RESTful API uses commands to obtain resources. The state of a resource at any given timestamp is called a resource representation. A RESTful API uses existing HTTP methodologies such as:

  • GET to retrieve a resource;

  • PUT to change the state of or update a resource, which can be an object, file or block;

  • POST to create that resource; and

  • DELETE to remove it.

Data formats the REST API supports include:

  • application/json

  • application/xml

  • application/x-wbe+xml

  • multipart/form-data

What is SOAP?


SOAP is a standard communication protocol system that permits processes using different operating systems like Linux and Windows to communicate via HTTP and its XML. SOAP based APIs are designed to create, recover, update and delete records like accounts, passwords, leads, and custom objects.


These offers over twenty different kinds of calls that make it easy for the API developers to maintain their accounts, perform accurate searches and much more. These can then be used with all those languages that support web services.


SOAP APIs take the advantages of making web based protocols such as HTTP and its XML that are already operating the all operating systems that are why its developers can easily manipulate web services and get responses without caring about language and platforms at all.


SOAP API Medium :

  • HTTP(POST)


Data formats the SOAP API supports include:

  • XML(XML (or Extensible Markup Language) is a text format that establishes a set of rules to structure messages as both human- and machine-readable records.

Differences:


  • REST API has no official standard at all because it is an architectural style. SOAP API, on the other hand, has an official standard because it is a protocol.

  • REST APIs uses multiple standards like HTTP, JSON, URL, and XML while SOAP APIs is largely based on HTTP and XML.

  • As REST API deploys multiple standards, so it takes fewer resources and bandwidth as compared to SOAP that uses XML for the creation of Payload and results in the large sized file.

  • The ways both APIs exposes the business logics are also different. REST API takes advantage of URL exposure like @path("/WeatherService") while SOAP API use of services interfaces like @WebService.

  • SOAP API defines too many standards, and its implementer implements the things in a standard way only. In the case of miscommunication from service, the result will be the error. REST API, on the other hand, don't make emphasis on too many standards and results in corrupt API in the end.

  • REST API uses Web Application Description Language, and SOAP API used Web Services Description language for describing the functionalities being offered by web services.

  • REST APIs are more convenient with JavaScript and can be implemented easily as well. SOAP APIs are also convenient with JavaScript but don't support for greater implementation.





12 views0 comments

Recent Posts

See All

Mac - Step by Step - Install Eclipse, TestNg, Maven

Install Eclipse: Goto https://www.eclipse.org/downloads/packages/ Click on: Download Eclipse IDE for Java Developers Unzip the downloaded zip file and double click eclipse.exe. Choose a folder to set