0% found this document useful (0 votes)
0 views40 pages

9162826 Introduction to API and RESTful API

The document provides an introduction to APIs and RESTful APIs, explaining their functions, types, advantages, and disadvantages. It highlights the differences between APIs and web applications, as well as between SOAP and RESTful APIs. The summary concludes that APIs are crucial for software communication, with RESTful APIs offering a more flexible and simpler approach compared to SOAP.

Uploaded by

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

9162826 Introduction to API and RESTful API

The document provides an introduction to APIs and RESTful APIs, explaining their functions, types, advantages, and disadvantages. It highlights the differences between APIs and web applications, as well as between SOAP and RESTful APIs. The summary concludes that APIs are crucial for software communication, with RESTful APIs offering a more flexible and simpler approach compared to SOAP.

Uploaded by

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

Introduction to API and RESTful

API

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Agenda
In this session, we will discuss:
● Introduction to API and its Working

● Difference between API and Web Application

● Different Types of APIs

● Advantages and Disadvantages of API

● RESTful API and its Working

● RESTful API Client Request

● RESTful API Server Response

● Advantages and Disadvantages of RESTful API

● SOAP API Vs RESTful API

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Introduction to API

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Introduction to API
● APIs are tools that facilitate communication between
two software components by providing a predefined set
of definitions and protocols.
● APIs provide a set of rules, protocols, and tools that
developers can use to access the functionality and data
of another software system, service, or platform.
● APIs helps in structuring the requests and responses,
making it possible for developers to integrate various
services and functionalities into their own applications
without having to build everything from scratch.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Working of API

Rating
and
Feedback

Notifications Map API


API

User
Request

Driver
Real-Time
Matching
Tracking
API
Payment
Gateway
API
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Difference between API and Web
Application

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Difference Between API and Web Application

Factors API Web Application

Purpose It provides programmatic Allows some level of coding


access to data or services

Data Format Data is usually returned in a Data is displayed in a


structured format formatted manner on web
pages

User Experience Designed for developers Designed for end-users

Accessibility It can be accessed via code It can be accessed through a


or command line interface web browser

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Difference Between API and Web Application

Factors API Web Application

Customization It is flexible and Customization depends on


customizable the design and the
architecture of the web
application
Scalability It can handle a large number It is more complex to scale
of requests and it requires additional
infrastructure

Security It includes built-in security It relies on other layers (e.g.


features such as web server) for security
authentication and
authorization

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Different Types of APIs

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Different Types of API

RESTful APIs

1. Web APIs

SOAP APIs

Operating
System APIs
2. Hardware APIs

Device APIs

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Different Types of API

Python Standard
Library
3. Library APIs
JavaScript
Libraries

SQL APIs

4. Database APIs

No SQL APIs

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Different Types of API

Web Scraping
APIs
5. Data APIs
Data Provider
APIs

Cloud Service
APIs
6. Cloud APIs
Social Media
APIs

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Different Types of API
Device
Management
APIs
7. IoT APIs

Sensor APIs

Payment
Gateway APIs
8. Payment APIs

Banking APIs

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Advantages of APIs

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Advantages of APIs

Modularity and
Interoperability Scalability
Reusability

APIs promote APIs enable different As the demand for a


modularity by helping software systems, service grows, the
developers to break regardless of their developers can scale
down complex underlying by making additional
systems into smaller, technologies or API requests.
manageable platforms, to
components. communicate and
work together.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Advantages of APIs

Rapid Development Cost-Effective Enhanced Security

APIs accelerate Developing every APIs can enhance


development by aspect of an security by controlling
providing pre-built application from and limiting access to
functionalities and scratch can be certain parts of a
services. expensive and time- system or data.
consuming.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Advantages of APIs

Improved User
Data Integration Testing and Debugging
Experience

APIs make it easier to APIs can be tested and By leveraging APIs for
integrate data from debugged features like maps,
various sources and independently, social media sharing,
services into a single allowing developers and third-party logins,
application. to identify and applications can offer
address issues more a more engaging and
efficiently. feature-rich user
experience.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Disadvantages of APIs

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Drawbacks of API

Maintenance Limited Control


Security Concerns Challenges

APIs can be vulnerable Changes to the When the external


to security threats if underlying system or APIs are used the
not properly secured. service can break users will have limited
compatibility with control over the
existing API clients. underlying service.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Drawbacks of API

Documentation and Costs Complexity


Support

APIs are not free to Dealing with multiple


Poorly documented
use, and costs can add APIs in a complex
APIs can lead to
up, particularly for system can introduce
confusion and slower
high-volume usage. additional complexity
development.
in terms of
integration,
debugging, and error
handling

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
RESTful API

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Introduction to RESTful API
● REST is an architectural style and a set of constraints for
designing networked applications.
● In RESTful APIs each request from a client to a server
must contain all the information needed to understand
and process the request.
● In REST, the resources are identified by unique URLs
(Uniform Resource Locators).
● REST uses standard HTTP methods (GET, POST, PUT,
DELETE, etc.) to perform actions on resources.
● RESTful APIs are relatively simple to understand and
use.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Working of RESTful API

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Working of RESTful API

The client sends a request to the


The server then authenticates the
server and follows the API
client and confirms that the client
documentation to format the
has the right to make that
request in a way that the server
request.
understands.

The server receives the request The server returns a response to


and processes it internally. the client

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
RESTful API Client Request

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
RESTful API Client Request
Cookies
to maintain
session HTTP Method
Accept Header
information GET, POST ,
JSON, XML, or PUT and
HTML DELETE

Authentication
Request Headers
Credentials Authentication
API keys,
tokens,
tokens, or
Content type
username
Client

Query Parameters Request URL


query Domain, Path
parameters in and Query
the URL Request Body parameters
formats like
JSON or XML
Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
RESTful API Server Response

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
RESTful API Server Response

HTTP Status Code


Cookies Successful,
error or further
action

Metadata Request Headers


timestamps, content type,
version caching
numbers, or directives
links Server

Error Messages
Response Body
details
explaining the JSON, XML,
issue HTML,

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Advantages of RESTful API

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Advantages of RESTful APIs

Simplicity and Ease of Scalability Flexibility


Use

The use of standard RESTful APIs are RESTful APIs are


HTTP methods and inherently scalable versatile and can be
status codes simplifies because they are used with various
the interaction with stateless and do not data formats, such as
APIs. require the server to JSON, XML, HTML,
store client-specific and more.
information between
requests.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Advantages of RESTful APIs

Platform Independence Statelessness Caching

RESTful APIs are RESTful APIs are HTTP, the underlying


platform- stateless, meaning protocol for RESTful
independent, that each request APIs, supports
meaning that clients from a client to a caching.
and servers can be server contains all the
implemented in information needed
different to understand and
programming process the request
languages and run on
different platforms.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Advantages of RESTful APIs

Uniform Interface Accessibility Security

RESTful APIs adhere RESTful APIs are RESTful APIs can


to a uniform and accessible over implement security
consistent interface, standard HTTP mechanisms, such as
which includes protocols, making authentication and
standard HTTP them available to a authorization, to
methods (GET, POST, wide range of clients. protect resources and
PUT, DELETE) and data.
status codes.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Disadvantages of RESTful API

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Disadvantages of RESTful APIs

Overfetching and Limited Lack of Built-in Error


Underfetching Standardization Handling

RESTful APIs often While REST is a widely REST does not provide
return fixed data accepted a standardized way of
structures, which can architectural style, handling errors.
lead to overfetching there's no strict
or underfetching. standard for how to
implement it.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
SOAP API

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Introduction to SOAP API
● SOAP (Simple Object Access Protocol) is a protocol for
exchanging structured information in the
implementation of web services.
● A SOAP API (Application Programming Interface) is an
interface that allows applications to communicate with
each other using the SOAP protocol.
● SOAP is used for sending messages between
applications over various protocols, including HTTP,
SMTP, and more.
● SOAP provides mechanisms for security, including
encryption and authentication, which can be essential
in enterprise-level applications.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
SOAP API Vs RESTful API

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Difference Between SOAP and REST

Feature SOAP REST

Full Form Simple Object Access Representational State


Protocol Transfer

Purpose SOAP is a protocol for REST is an architecture style


communication between for designing
applications communication interfaces.

Design SOAP API exposes the REST API exposes the data
operation.
Protocol SOAP is independent and REST works only with HTTPS
can work with any transport
protocol.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Difference Between SOAP and REST

Feature SOAP REST

Data Format Transports data in standard REST supports XML, JSON,


XML format. plain text, HTML

Performance SOAP messages are larger, REST has faster performance


which makes due to smaller messages and
communication slower. caching support.

Scalability SOAP is difficult to scale REST is easy to scale

Security SOAP supports encryption REST supports encryption


with additional overheads. without affecting
performance.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
Summary
Here’s a brief recap:
● APIs are essential tools for enabling seamless communication between software components, offering

predefined definitions and protocols.


● APIs furnish developers with rules and tools to access external software system functionality,

streamlining request and response structuring and allowing easy integration of diverse services into
their own applications without starting from scratch.
● SOAP and RESTful are two distinct approaches for designing web APIs, with SOAP being more rigid and

protocol-based, while RESTful follows a simpler, flexible, and stateless architecture.

Proprietary content ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

You might also like