0% found this document useful (0 votes)
11 views6 pages

API

Uploaded by

ubi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views6 pages

API

Uploaded by

ubi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Name: Ubendra S

Email: ubendrass@gmail.com

API:
An API (application programming interface) is a set of rules that
allows various software applications to talk to one another. It can be
viewed as a bridge between two software applications (client and server)
allowing them to communicate and interact.

To understand the role of an API even better, consider how it works


at a restaurant. The waiter (API) takes your order (request) and tells the
chef (server). After the chef has prepared your food (response) the waiter
brings it back to your table. Similarly, when you look for a course on a
website, your request goes through an API that fetches the data from the
database and brings it back in the response.

Purpose of an API:
The primary purpose of an Application Programming Interface (API)
is to enable communication and interaction between different software
applications. It acts as an intermediary, defining a set of rules and
protocols for how software components should interact, exchange data,
and access functionality from other systems.
Key purposes of APIs include:
1. Integration Between Systems

APIs connect different systems or platforms so they can work together.

 Example: A travel website uses APIs to fetch flights from airlines,


hotel listings from booking engines, and weather info from weather
services—all into one dashboard.

2. Data Access Without Exposing Internal Logic

APIs allow users to access data or services without exposing how


the system works internally.

 Example: A mobile banking app accesses your account balance via


API without showing how the bank’s internal system processes that
request.

3. Automation

APIs allow tasks to be automated between services, reducing the need


for manual intervention.

 Example: An ecommerce site uses a payment gateway API to


automatically process transactions.

4. Reusability & Scalability

APIs make it easy to reuse functions or services across multiple


applications.

 Example: Google Maps API can be reused across thousands of apps


that need map features, from ride-hailing to delivery.

5. Faster Development

Developers can build apps quickly by using existing APIs instead of


writing complex features from scratch.

 Example: Instead of building your own login system, you can use
Google OAuth API for sign-in.

6. Security

APIs can control access to resources via authentication and


permissions, allowing only authorized users.
 Example: Cloud services like AWS or Azure provide secure access
via API keys or tokens.

APIs Work:
APIs work in a simple step-by-step process:

 Request: A client (user) sends a request through the API's URI


(Uniform Resource Identifier).

 Processing: The API forwards the request to the server.

 Response: The server processes the request and sends the


response back to the API.

 Delivery: The API returns the server's response to the client.

Types of APIs:

1. WEB APIs

A Web API also called Web Services is an extensively used API over
the web and can be easily accessed using the HTTP protocols. A
Web application programming interface is an open-source interface
and can be used by a large number of clients through their phones,
tablets, or PCs.

2. LOCAL APIs

In this type of API, the programmers get the local middleware


services. TAPI (Telephony Application Programming Interface), and .NET
are common examples of Local APIs.

3. PROGRAM APIs

It makes a remote program appear to be local by making use of


RPCs (Remote Procedural Calls). SOAP is a well-known example of this
type of API.

Types of API Architectures:


1. REST :A simple, flexible API architecture that uses HTTP methods
(GET, POST, PUT, DELETE) for communication.

2. SOAP : A more rigid protocol that requires XML-based messaging


for communication.
REST API (Representational State Transfer):
REST:

REST is an architectural style used to design networked


applications. RESTful APIs use HTTP methods (like GET, POST, PUT,
DELETE) to perform operations on resources, which are typically
represented as JSON or XML.

Key Features of REST API:

 Stateless: Each request is independent; the server does not store


any client context.

 Uses standard HTTP methods:

o GET – Retrieve data

o POST – Create data

o PUT – Update data

o DELETE – Remove data

 Lightweight and easy to use

 Data usually in JSON, which is faster and more readable than XML

Examples:

 Google Maps API for getting map data

 Spotify API for getting song or playlist info

 Weather APIs to get forecasts

SOAP API (Simple Object Access Protocol):


SOAP:

SOAP is a protocol for exchanging structured information using


XML over various protocols (HTTP, SMTP, etc.). It is highly standardized
and often used in enterprise-level applications.
Key Features of SOAP API:

 Strict structure defined by WSDL (Web Services Description


Language)

 Supports security (WS-Security), ACID-compliant transactions,


and reliable messaging

 Communicates using only XML

 Works with multiple transport protocols, not just HTTP

Examples:

 Payment gateways (used for secure transactions)

 Government and healthcare systems

 Airline booking systems (Amadeus, Sabre)

SOAP vs. REST:

SOAP REST

REST (Representational State


SOAP (Simple Object Access
Transfer) is a set of
Protocol) is a protocol with
guidelines (architectural
specific requirements like
style) offering flexible
XML messaging
implementation

Heavier and needs more Lightweight and needs less


bandwidth bandwidth

It inherits security from the


It defines its own security
underlying transport

It permits XML-based data It permits different data formats such


format only as plain text, HTML, XML, JSON, etc.

SOAP calls cannot be


REST calls can be cached
cached

You might also like