0% found this document useful (0 votes)
23 views15 pages

Apis Protocolss

The document provides an overview of web API protocols, focusing on REST, SOAP, and GraphQL. REST is an architectural style that emphasizes stateless interactions and uses HTTP for communication, while SOAP is a protocol that utilizes XML for structured data exchange and is suited for enterprise applications requiring high security. GraphQL offers a more flexible approach by allowing clients to request specific data through a single endpoint, reducing data over-fetching and under-fetching.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views15 pages

Apis Protocolss

The document provides an overview of web API protocols, focusing on REST, SOAP, and GraphQL. REST is an architectural style that emphasizes stateless interactions and uses HTTP for communication, while SOAP is a protocol that utilizes XML for structured data exchange and is suited for enterprise applications requiring high security. GraphQL offers a more flexible approach by allowing clients to request specific data through a single endpoint, reducing data over-fetching and under-fetching.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

A DEEP DIVE

INTO WEB API


PROTOCOLS
REST,SOAP
AND GRAPH
QL
REST
What is REST ?
-Representational State Transfer (REST) -
is an architectural style that defines a set of
constraints to be used for creating web
services.
.REST uses less bandwidth, simple and
flexible making it more suitable for internet
usage. It’s used to fetch or give some
information from a web service. REST is an
architectural style and is not tied to any specific
protocol, HTTP is the most commonly used protocol for

REST APIs due to its ubiquity and simplicity.REST


2
API’S allows clients to interact with severs
WHAT IS HTTP?
(HYPERTEXT TRANSFER
PROTOCOL) IS A FUNDAMENTAL
PROTOCOL OF THE INTERNET,
ENABLING THE TRANSFER OF DATA
BETWEEN A CLIENT AND A SERVER.
PROVIDES A STANDARD BETWEEN A
WEB BROWSER AND A WEB SERVER
TO ESTABLISH COMMUNICATION. IT
IS A SET OF RULES FOR
TRANSFERRING DATA FROM ONE
COMPUTER TO ANOTHER.
HTTP
REQUEST/RESPONSE:
•Client sends an HTTP request: The client (usually a web
browser) initiates the process by sending an HTTP request to
the server. This request includes a request method (GET,
POST, PUT, DELETE, etc.), the target URI (Uniform Resource
Identifier, e.g., a URL), headers, and an optional request body.

•Server processes the request: The server receives the


request and processes it based on the requested method and
resource. This may involve retrieving data from a database,
executing server-side scripts, or performing other operations.
•STATELESS: EACH REQUEST IS INDEPENDENT,
AND THE SERVER DOESN'T RETAIN PREVIOUS
INTERACTIONS' INFORMATION.
METHODS OF
HTTP
•GET: Used to retrieve data from a specified resource. It should
have no side effects and is commonly used for fetching web
pages, images, etc.

•POST: Used to submit data to be processed by a specified


resource. It is suitable for form submissions, file uploads, and
creating new resources.

•PUT: Used to update or create a resource on the server. It


replaces the entire resource with the data provided in the
request body.

•PATCH: Similar to PUT but used for partial modifications to a


resource. It updates specific fields of a resource rather than
replacing the entire resource.

•DELETE: Used to remove a specified resource from the server.

5
RESTFUL REST (Representational State Transfer) is an architectural
style for designing networked applications. For a web service
to be considered RESTful, it must conform to a set of
constraints defined by REST principles.

1. Client-Server Architecture

•Definition: The client and server are separate entities, and


each focuses on specific tasks.

2. Statelessness

•Definition: Each client request to the server must contain all


the information needed to process the request. The server
does not store any client context between requests.

6
5. Layered
System
3. Cacheability •Definition:
architecture The
can
be composed
multiple of
layers,
•Definition: Responses from the each with a
specific
server must explicitly state whether responsibility
(e.g., load
they are cacheable or not. If a balancers,
security layers,
response is cacheable, the client (or
caching proxies,
application
an intermediary) can reuse it for
servers).
6. Code on
subsequent requests.
Demand
(Optional)
4. Uniform Interface
•Definition:
Servers can
•Definition: All interactions between extend client
functionality by
the client and server must follow a transferring
executable code
standardized approach, ensuring (e.g., JavaScript)
to the client.
consistency and simplicity.
Why is it Optional?
Not Always
1.
Many RESTful Necessary:
systems are
designed
exchanging to focus
data solely
between onthe
client and the
executable server.
code is Sending
unnecessary
systems and adds for these
complexity.
Client
2.
One of Independence:
REST's principles is
that the
should client
becode and server
independent.
Sending
client more can makeon
dependent the
the
server for specific
functionality, potentially
7
SOAP
What is SOAP?
Simple Object Access Protocol (SOAP) is a
network protocol for exchanging structured data
between nodes. It uses XML (Extensible Markup
Language) format to transfer messages. It works
on top of application layer protocols like HTTP
and SMTP for notations and transmission. SOAP
allows processes to communicate throughout
platforms, languages, and operating system,
since protocols like HTTP are already installed on
all platforms. SOAP is suited for enterprise-level
applications that require high security, and
reliability.
8
WHAT IS XML?

Extensible Markup Language (XML) is a type of markup


language that establishes a set of guidelines for
encoding texts in a way that is both machine- and
human-readable. For storing and transferring data on
the web and in many other applications, XML is widely
used. XML steps in as a versatile tool for encoding and
organizing data in a way that both humans and
machines can comprehend.

9
THE MESSAGE IN XML FORMAT
CONTAINS FOUR PARTS WHICH ARE :

• Envelope: This specifies that the XML message is a


SOAP message. A SOAP message is an XML document
containing a header and a body, both encapsulated
within the envelope. Any fault is included within the
body of the message.
• Header: This part is optional. When present, it can
provide crucial information about the applications.
• Body: This contains the actual message being
transmitted. Faults are contained within the body
tags.
• Fault: This optional section contains the status of the
application and any errors. It should not appear more
than once in a SOAP message.
10
ADVANTAGES VS
DISADVANTAGES
• Platform and Language •Complexity: More complex due to XML
Independent: Works across structure.
different systems. •Performance Overhead: Slower and
• High Security: Supports advanced more resource-intensive.
security features like WS-Security. •Tight Coupling: Harder to modify as
• Reliable: Built-in mechanisms for services are closely linked.
reliable message delivery. •Limited Browser Support: Not as
easy to use with modern web apps.
• Standardized: Well-defined for
•Lack of Caching: Limited caching
formal, enterprise-level
integrations. capabilities.
•Overkill for Simple Use Cases: Too
• Error Handling: Includes
structured error handling with Fault complex for basic operations.
elements.

11
WHEN DO WE NEED SOAP?

Enterprise-Level Applications: For systems that


require strong security, transactional integrity,
and complex workflows.
Inter-Organizational Communication: When
multiple organizations need to interact and
exchange data securely.
Legacy System Integration: When integrating
older systems that already use SOAP.
High-Security Environments: For applications
where data confidentiality and integrity are
crucial (e.g., banking, insurance, and healthcare).

12
THE DIFFERENCES BETWEEN SOAP AND
REST​
SOAP API REST API

Relies on SOAP (Simple Object Access Relies on REST (Representational State


Protocol) Transfer) architecture using HTTP.

Generally, transports data in JSON. It is


based on URI. Because REST follows
Transports data in standard XML format. stateless model, REST does not
enforce message format as XML or
JSON etc.

Because it is XML based and relies on


SOAP, it works with WSDL(web services It works with GET, POST, PUT, DELETE
description language)

Works over HTTP, HTTPS, SMTP, XMPP Works over HTTP and HTTPS

Highly structured/typed Less structured -> less bulky data

Designed with large enterprise


Designed with mobile devices in mind
applications in mind 13
WHAT IS GRAPH QL ?

What is Graph QL?


Graph QL is a query language for APIs and a runtime for executing those queries
against your data.
Difference between rest & graph Ql?
REST, which exposes multiple endpoints for different resources, Graph QL exposes a
single endpoint that allows clients to request exactly the data they need.
What it's benefit?
This reduces over-fetching and under-fetching of data. In Graph QL, clients define
the structure of the response, and the server only returns the data as requested. It
also supports real-time updates with subscriptions.
What is the advantages of Graph QL ?
offers more flexibility, efficiency, and control over data fetching compared to
traditional REST APIs.

14
THANK YOU

You might also like