top of page

RESTify Your Knowledge: Essential Intro to REST APIs

What is API?


API stands for Application Programming Interface. In simpler terms, it's a middleman that allows applications to talk to each other. APIs are all around us. Every time you use a Ola app, send a mobile payment, or change the thermostat temperature from your phone, you’re using an API.



API follows client server architecture, receiving request from client side which may be a software or end users, from laptops/mobile applications and send back the requested resources and data as responses from server, e.g. REST. Client demands are sent as requests which are URL resources and responses are sent back to clients from servers which are in JSON format.


Why APIs?


Abstraction

API hides the complexity and intricacies of any software or service they provide access to. Client uses API but unaware of the underlying complexities in developing that API.

 

Extensibility

API is scalable. Once created with certain nodes or users, it can be extended and used by any number of end users. It allows developers to create add-ons, plugins, and custom integrations that enhance the base application.


Standardization

APIs provide a common language for software communication. This reduces development complexity and ensures different applications can understand each other's data and functions.


Innovation

By leveraging APIs from various services, developers can create entirely new applications or features that wouldn't be possible otherwise. This fuels creativity and drives innovation in the software landscape.


API Categories


The below table provides a general overview of the characteristics and differences between public, private, partner, and composite APIs

Features

Public APIs

Private APIs

Partner APIs

Composite APIs

Scope

Used by any organization

Developed by an organization for its internal use to communicate between various departments.

Shared to selected private third party to access selected data.

Multiple APIs are integrated so that can be used as such when needed.

Security

Generally less secure

Access given to specific people only based on their needs to use the APIs

High security

Security depends on the application used.

Areas of Application

Weather Forecast , social media applications like Facebook

A Banking app used to perform various operations on a customer account, uses private API to communicate between them.

Airlines that create partnership  with API to telecast flight availability

Make my Trip App which uses flight details of Indigo, Scoot etc.

API Design


In HTTP requests, we have the action followed by target resource. Action is usually method name (PUT, GET, POST, DELETE), a Verb as it mentions, the action to be performed on the resource of given URI. Noun is an entity name and hence in HTTP, URI are nouns that act as identifiers for resources such as  images, data objects or a web page. As a standard, URIs should be designed as nouns that specify the contents of the resource, rather than adding a verb for the function being performed.


POST, GET, PUT, DELETE are the most commonly used HTTP methods. They perform CRUD operations which are most frequently performed operations. Also, we can perform retrieving data using both POST and GET, although GET is the proper verb to use for the retrieval of data. Always follow proper terminologies to maintain standards so that it would be understandable by anyone.



GET Method

Retrieves data from the server. When you type a web address into your browser and hit enter, you're essentially sending a GET request to the server for that web page. Thus, it can be used for loading web pages, images, videos, etc.


In the example below, we can see GET method requests for the details of users in page number 2 and the same is displayed in response as JSON data.



POST Method

This method is used to send data to the server. Thus mainly used to create new resources. Submits data to be processed to the server. Data is sent in the body of the request, separate from the URL.


 In the example below, POST method creates a new user with id “445”.



PUT Method

Updates or completely replaces the resource at the specified URL using the data in the request body.


In the below example, PUT method updates the resource with new data value for name and age.



DELETE Method

Deletes the specified resource from a server. It's essentially an instruction sent to the server to permanently remove a piece of data. They rely solely on the URL to specify the resource to be deleted. Due to its permanent nature, DELETE requests should be used with caution. There's no "undo" button after a successful deletion.


In the below example, we delete the user details with user id  “2”.



Other HTTP Methods

Methods

Purpose

PATCH

Apply partial modifications to the data in server.

OPTIONS

Retrieves the http methods supported by server for a URI.

TRACE

Echoes back the received request for debugging.

HEAD

Retrieves headers without body for a specific resource response.

CONNECT

Connects to server, identified by target resource using a tunnel.

PROPFIND

Retrieves properties stored as XML from a web server.

PROPPATCH

Send data to server to make changes to properties.

MKCOL

Creates a new collection server.

API supports the high demand of society by giving flexibility to developers for advanced software developments, allows fast connectivity between various platforms and devices, gives comfortable hands-on experience to users and also create happy customers with its personalization of products and services to customers based on their needs.

Comments


bottom of page