Understanding APIs_ Types Purposes and Implementation.pptx
1.
Understanding APIs
Types, Purposes&
Implementation
Exploring REST and SOAP APIs with Real-World
Examples
Clien
t
API Server
August 19,
2025
2.
What is anAPI?
API (Application Programming Interface) is a set of rules and protocols that allows different software
applications to communicate and exchange data with each other.
API as a Digital
Messenger
Takes requests from one application, delivers them to
another, and returns responses
Enables integration of new features without building
everything from scratch
Fosters speed and innovation in software
development
Real-Life
Example
A weather application on a
smartphone:
1 The app sends a request (e.g., "What is the weather in
London?") to a weather bureau's server
2 The server processes the request and sends the data back to
the app
3 The app displays the weather information to the
user
Request
3.
API Types byAvailability
APIs can be categorized based on who is permitted touse
them:
Public
APIs
Open for general
use
Available to
anyone
Minimal
restrictions
Example: Google Maps
API
Partner
APIs
Restricted to business partners
Business-to-business
integration
Strong
authentication
Example: Bank sharing data with
financial planning app
Private
APIs
Internal organizational use
For organization use
only
Connect internal
systems
Example: HR system linked to
payroll platform
Publi
c
Partner Private
3/10
4.
API Types byArchitecture
APIs can be categorized by their architectural style, each offering different approaches to structuring communication
between systems.
RES
T
Representational State
Transfer
Architectural style, not
a protocol
Uses standard HTTP
methods
Stateless and
scalable
Focuses on resources via
URIs
Example
:
GET /users/123
SOA
P
Simple Object Access
Protocol
Strict protocol defined by
W3C
Relies exclusively on
XML
More rigid and
structured
Includes WSDL for
contracts
Example
:
<CreateUser>
<Name>John</Name>
</CreateUser>
RP
C
Remote Procedure
Call
Older and simpler API
type
Client executes function
on server
Includes JSON-RPC and
XML- RPC
Example
:
add(5, 3) → 8
GraphQ
L
Query Language for
APIs
Developed by Facebook
(2012)
Open-sourced in
2015
Single endpoint instead
of multiple
Clients specify exact
data needed
Example
:
{ user(id: 123) { name,
email } }
Additional API Types
While this presentation focuses on web-based APIs, it's important to note that APIs also exist for operating systems and software libraries,
enabling applications to interact with the underlying OS or leverage pre-written code for specific functions without a network connection.
5.
REST APIs inDetail
Client-Server
Separation
Client and server are independent. They can
evolve separately without affecting each other, as
long as the interface remains consistent.
Statelessness
Each request must contain all information
needed. The server does not store client context
between requests, improving scalability.
Uniform
Interface
Simplified and decoupled architecture using
standard HTTP verbs (GET, POST, PUT, DELETE)
to perform actions on resources.
Cacheability
Responses define themselves as cacheable or
non- cacheable. Caching improves performance
and reduces server load.
Layered System
Clients cannot tell whether they're connected directly to the end server or to an intermediary. This
allows for load balancers and proxies to improve scalability and security.
REST (Representational State Transfer) is not a protocol but an architectural style for designing networked applications.
It's the most popular approach for building web APIs today.
Key REST Architecture Principles
REST Benefits
Lightweight & Flexible
Uses standard HTTP methods and
supports various data formats, with JSON
being the most common.
Scalable Easy to use
Language-agnostic Human-readable
Cachable
Data Storage
6.
Real-Life REST APIExamples
Social Media Integration
The Twitter API allows developers to
interact with Twitter's functionality.
GET request to /statuses/user_timeline
7.
SOAP APIs in
Detail
SOAPProtocol
Structure
Envelope: Root element identifying the XML as a SOAP
message
Header: Optional element for application-specific
information (auth, routing)
Body: Mandatory element containing request or response
data
Fault: Optional element for error
reporting
WSDL-based Contract System
Web Services Description Language (WSDL) is an XML-based file
that acts as a blueprint for the API.
Details available functions, data types, and how to call
them Removes ambiguity for developers
Machine-readable description of the service
SOAP Message
Structure
SOAP
Envelope
Header
Authentication,
Routing
Body
8.
Real-Life SOAP APIExamples
SOAP APIs are widely used in scenarios requiring security, reliability, and stateful
operations
Financial
Services
Challenge:
Secure processing of financial transactions
where integrity is non-negotiable
Solution:
SOAP's built-in security (WS-Security)
and ACID transaction properties ensure
data integrity and reliability
<soap:Envelope>
<soap:Body>
<ProcessPayment>
<amount>100.00</
amount>
</ProcessPayment>
</
soap:Body>
</
soap:Envelo
pe>
Enterprise
Systems
Challenge:
Integration of complex internal systems
requiring reliable communication
Solution:
SOAP's stateful nature and standardized
error handling enable reliable
communication between HR and payroll
systems
HR
System
Payroll
System
Telecommunication
s
Challenge:
Complex account management requiring
multi-step transactions
Solution:
SOAP's reliability features ensure that
customer account creation and billing
operations complete successfully or fail
entirely
9.
REST vs SOAP:Key Differences
REST (Representational State
Transfer)
SOAP (Simple Object Access
Protocol)
Feature RES
T
SOAP
Architecture
Architectural Style
Data-driven (Resources)
Uses standard HTTP
verbs Stateless
Protocol
Function-driven (Operations)
XML-based messages
Can be stateful
Data
Format
Flexible: JSON, XML,
HTML JSON is standard
Compact messages
Only XML
Large, verbose
structure Higher
bandwidth use
Securit
y
Transport security
(HTTPS) API keys, OAuth,
JWT
Built-in WS-Security
Message-level
encryption Digital
signatures
Performanc
e
Lightweight messages
Stateless improves scalability
Caching support
Large XML messages
Stateful creates
overhead Less efficient
processing
10.
Case Study: E-commercePlatform API
Implementation
GET /products?category=electronics
GET /products/{product_id}
A modern e-commerce platform uses a hybrid approach combining different API types to balance performance and security based on
specific requirements.
REST API: Product Catalog & User Experience SOAP API: Payment Processing
Functionality: Browsing products, searching, viewing item details Functionality: Processing payments during checkout
Data Format: JSON for lightweight, easy parsing Data Format: XML with structured messages
Advantages: Flexibility, scalability, performance, stateless nature Advantages: Built-in security, reliability, ACID
transactions
<soap:Envelope>
<soap:Body>
<ProcessPayment>
<amount>100.00</
amount>
<currency>USD</
currency>
</ProcessPayment>
</soap:Body>
</
soap:Envelop
e>
Customer