0% found this document useful (0 votes)
4 views99 pages

unit 1

The document provides an overview of web services and API design, detailing their types, building blocks, and architectural styles such as Service-Oriented Architecture (SOA) and Resource-Oriented Architecture (ROA). It explains the differences between RESTful and SOAP web services, their use cases, and the importance of protocols and data formats like XML and JSON. Additionally, it discusses the advantages and disadvantages of SOA and ROA, along with their applications in various industries.
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)
4 views99 pages

unit 1

The document provides an overview of web services and API design, detailing their types, building blocks, and architectural styles such as Service-Oriented Architecture (SOA) and Resource-Oriented Architecture (ROA). It explains the differences between RESTful and SOAP web services, their use cases, and the importance of protocols and data formats like XML and JSON. Additionally, it discusses the advantages and disadvantages of SOA and ROA, along with their applications in various industries.
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

U21CSP13- Web services and

API Design
UNIT I INTRODUCTION
Web Services - Building Blocks, Types: Service Oriented architectures -
resource oriented architectures, API architectures, Micro services and
architectures, HATEOAS, REST, URI, Code on Demand
TOPIC 1 :Web Services & API

► Web services are software systems that allow different applications to


communicate and exchange data with each other over the internet.
Example : Travel booking web site
► API stands for Application Programming Interface.
► It is a set of rules and protocols that allows different software applications to
communicate with each other. Ex: Weather widget.
► Doesn’t always need internet
► API defines how software components interact.
Differences
Real time examples

► Web services
► Weather Applications
► Social login
► E-Commerce payments
► Youtube
► API
► Ride booking (Uber,Cal taxi)
► Google Map
Building blocks- Web services
Core components are : 1. SOAP [Link] 3.
WSDL
Building blocks

► Web services are modular, self-contained software applications that


communicate over a network. They allow systems written in different
languages and on different platforms to exchange data.
[Link] Formats
► Data formats define how messages are structured and encoded so they
can be universally understood by varying client and server systems.
► XML (Extensible Markup Language): A highly structured, tag-based markup language used
primarily in traditional SOAP-based web services.
► JSON (JavaScript Object Notation): A lightweight, human-readable format that uses key-value
pairs. It is the standard for modern, RESTful web services due to its low overhead and fast parsing.
Continued..
2. Protocols
► Protocols act as the rulebook, governing how messages are safely
and reliably transmitted and exchanged between applications.
► HTTP/HTTPS: The foundational transport protocol of the web, used to send requests and
receive responses.

► SOAP (Simple Object Access Protocol):


► Highly structured protocol for exchanging messages.
► A strict, XML-based messaging protocol that provides robust security and transactional
reliability for enterprise-level applications.
► KEY CHARACTERISTICS :
► Platform and Language independence
► Strict contract WSDL – i.e) This acts as a formal, machine-readable contract detailing what
functions are available, data types required, and how to format the requests
► Built in error handling
► Enterprise security
REST (Representational State
Transfer):
► An architectural style utilizing HTTP verbs (GET, POST, PUT,
DELETE) to manage data and operations directly.
► RESTful Web Services are a way of designing and developing
web services that use REST (Representational State Transfer)
principles. They enable applications to communicate over the
web using standard HTTP methods, such as GET, POST, PUT
and DELETE. REST is lightweight, stateless and widely used in
modern web and mobile applications.
Core Principles of REST

❖ Uniform Interface: Standardizes interactions by utilizing unique URLs to target data resources and using

uniform actions.

❖ Statelessness: Ensures that every single client request holds all the data needed for processing. The server

saves no context locally from previous requests.

❖ Client-Server Separation: Decouples the user interface from the data storage layer so that both components

can evolve independently.

❖ Cacheable Responses: Forces server communications to label data payload types as cacheable or

non-cacheable to minimize latency and optimize network bandwidth.

❖ Layered System: Enables the application architecture to route traffic across hidden intermediary servers like

load balancers and firewalls seamlessly.


► Cross-Platform Communication: Applications built in different languages and
environments can easily talk to each other.
► Mobile-Friendly: REST works smoothly on mobile devices without extra effort.
► Cloud Compatibility: Most modern cloud platforms and architectures are based on
REST principle
3. Interface Description (WSDL)
WSDL (Web Services Description Language): An XML-based document that functions as
a machine-readable "contract". It dictates exactly how a client can access the web service, what
operations it provides, the required input/output parameters, and data types.

► WSDL files are completely language- and platform-independent, making them the cornerstone
of interoperability in Service-Oriented Architectures (SOA). Because it is machine-readable.

► It was started and developed by Microsoft and IBM in March 2001. it is XML based language
format used to describe functionalities and operations involved in web services
Structure of a WSDL document
4. Service Discovery (UDDI)
► UDDI (Universal Description, Discovery, and Integration): A directory service or registry that

allows service providers to advertise their web services and lets requesters locate available

services to use.

► It is an XML-based framework and directory that allows businesses to list, describe, and

discover web services. service providers, access their technical specifications, and integrate

systems dynamically over the internet.


5. The Architectural Entities (Roles)
• Web services operate via the dynamic interaction of three core
components:
• Service Provider: The entity (or server) that creates, hosts, and publishes the
web service.
• Service Requester: The client application (desktop, mobile, or microservice)
that searches for and invokes the web service to perform a task.
• Service Broker (Registry): The platform hosting the directory (UDDI) that
allows requestors to find service providers.
• Acting like a digital phonebook for web applications, it enables developers to
find
TOPIC 2 : TYPES (WEB SERVICES)

► The two primary types of web services used to exchange data between
applications are
1. RESTful web services and
2. SOAP web services.
► JAX-WS- Java Standard for building SOAP based Web services
► JAX-RS – Java Standard for building RESTful web services
[Link] Web Services
(Representational State Transfer)
► REST is an architectural style rather than a strict protocol.

► Data Format: Supports multiple lightweight formats like


JSON (most common), XML, HTML, and plain text.
► Protocol: Built directly on top of HTTP/HTTPS.
► State: Strictly stateless; each request from a client must
contain all necessary information to process it.
► Best For: Mobile applications, public web APIs, and agile
web applications requiring high scalability.
2. SOAP Web Services (Simple Object
Access Protocol
SOAP is a rigid, official messaging protocol defined by the W3C. It relies heavily on strict
contracts to enforce communication rules

Data Format: Strictly limited to XML.

• Protocol: Transport-independent; it can run over HTTP, SMTP, or FTP.

• Contract: Uses a WSDL (Web Services Description Language) file to explicitly define the
interface and actions available.

• Security: Built-in WS-Security provides institutional-grade encryption and digital signatures.

• Best For: Enterprise applications, banking systems, and financial transactions requiring high
security
When to use REST (Representational State
Transfer)

► Web and Mobile Applications: Perfect for consuming data in user-facing applications
where bandwidth and payload sizes must be minimal.
► Scalability: The architecture is stateless. Because servers do not have to maintain
session states between requests, they scale much easier.
► Speed and Caching: Supports built-in HTTP caching, which improves performance
and response times for repeated data requests.
► Simplicity and Flexibility: Requires less setup and has a smaller learning curve. It
supports multiple data formats like JSON, XML, and HTML (with JSON being the
most common).
When to use SOAP (Simple Object
Access Protocol)
► Strict Security and Compliance: Built-in WS-Security allows for encrypted, auditable
transactions and digital signatures, making it ideal for financial and healthcare systems.
► Contract-First Requirements: Enforces a rigid contract (WSDL) that guarantees how
client and server must exchange data. This minimizes ambiguity between large
enterprise systems.
► Complex Transactions: Better suited for operations requiring strict ACID compliance
(Atomicity, Consistency, Isolation, Durability) where complete reliability of the
transaction is mandatory.
web services can be categorized into four distinct technical
types based on their underlying architecture and protocols:

3. XML-RPC & JSON-RPC (Remote Procedure Call)

RPC web services allow a client to execute a function or procedure on a remote server as if it were running locally.

• XML-RPC: Encodes function calls in basic XML formats and transmits them via HTTP. It is the oldest, most
foundational web service type.

• JSON-RPC: A lightweight alternative that replaces bulky XML formatting with clean JSON scripts.

• Best For: Straightforward command-and-response applications with minimal infrastructure.

4. UDDI (Universal Description, Discovery, and Integration)

UDDI serves a specific niche as an information directory rather than a direct communication pipeline.

• Function: It acts like a global "Yellow Pages" directory for businesses to publish, list, and locate available web services
on the internet.

• Format: Completely built on XML.


TOPIC 3 : SERVICE-ORIENTED
ARCHITECTURE (SOA)
- SOA means collection of services. These services communicate with each
other.
- Service-oriented architecture (SOA) is a method of software development
that uses software components called services to create business
applications.
- Each service provides a business capability, and services can also
communicate with each other across platforms and languages.
- Developers use SOA to reuse services in different systems or combine
several independent services to perform complex tasks.

-
SOA
Characteristics

► Services are independent and reusable.

► Loose coupling between services.

► Platform and language independent.

► Uses standard communication protocols such as HTTP, SOAP, and XML.

► Supports business process integration.

Components

Service Provider – Creates and provides services.

Service Consumer – Uses the services.

Service Registry – Stores information about available services.


Continued..

Advantages
High reusability
Easy integration of different applications
Better scalability
Easier maintenance
► Disadvantages
► Complex implementation
► Higher network overhead
► Security challenges
► Can become difficult to manage as the number of services grows
► Applications
► Banking systems (calculating loan ,processing payment)
Applications
SOA is widely used in various industries.
1. Banking Systems
► Online banking
► Fund transfer
► ATM services
► Loan processing
2. E-Commerce
► Online shopping
► Payment gateways
► Order tracking
► Inventory management
3. Healthcare
► Electronic health records
► Appointment scheduling
Continued..
4. Education
► Student information systems
► Online examinations
► Library management
5. Government Services
► Digital identity
► Tax payment
► Passport services
6. Airline Reservation
► Ticket booking
► Flight scheduling
► Online check-in
7. Cloud Computing
Cloud applications use SOA principles to provide scalable and reusable services.
Example of SOA

► Consider an online shopping website:


► Login Service – Authenticates users.
► Product Service – Displays products.
► Shopping Cart Service – Manages selected items.
► Payment Service – Processes payments.
► Delivery Service – Tracks orders.
► Each service operates independently but collaborates to complete the shopping process.
Continued…( Conclusion )

► Service-Oriented Architecture (SOA) is a modern software architecture that


organizes applications into independent, reusable services.

► It improves software flexibility, scalability, interoperability, and


maintainability while reducing development time and supporting integration
across diverse systems

► Although SOA introduces challenges such as higher implementation costs and


increased management complexity, it remains a widely adopted approach for
developing large-scale enterprise and distributed applications.
TOPIC 4 : Resource-Oriented Architecture
(ROA)
► Resource-Oriented Architecture (ROA) is an architectural style where everything is

treated as a resource and is identified using a Uniform Resource Identifier (URI).

► It is the foundation of RESTful web services.

► Resource-Oriented Architecture (ROA) is a software design paradigm that models an

application’s domain as a collection of informational entities called "resources".

► It is the structural foundation of RESTful web services, using unique URIs for

identification and standard HTTP methods like GET, POST, PUT, and DELETE to

manipulate them.

► ROA is a paradigm for designing networked software where systems interact via an

interconnected web of resources.


ROA
Principles
•Resources are identified by URIs.
•Uses standard HTTP methods.
•Stateless communication.
•Uniform interface.
HTTP Methods

Method Purpose
GET Retrieve data
POST Create data
PUT Update data
DELETE Remove data
An ROA system is defined by four core
concepts:
► Resources: These are the informational concepts in a system (e.g., a user profile, an
image, or an order). They can be static or dynamic.

► Resource Names (URIs): Every resource has a unique address.

► For example, [Link] specifically targets user 123.

► Representations: Because a client cannot interact directly with server data, a resource
is exposed through a representation, usually formatted as JSON/XML.

► Links between Resources: To make a system navigable and highly decoupled,


resource representations often include hyperlinks that point to related resources
Resource Oriented Model
Key Characteristics / Properties

► Addressability: Every piece of information can be located using a stable, semantic


URL.

► Statelessness: Each HTTP request from a client contains all the information the server
needs to fulfill it, meaning the server does not retain session states between requests.
ROA
Advantages
► Simple architecture
► Lightweight communication
► High scalability
► Easy to develop
Disadvantages
► Less suitable for complex business operations
► Stateless nature may require repeated authentication
Applications
► REST APIs
► Mobile applications
► Cloud services
► Social media APIs
Applications
► 1. E-Commerce Applications
► ROA is used in online shopping websites to manage products, customers, orders, and payments.
► Product catalog
► Shopping cart
► Order management
► Payment processing
► Example: Amazon, Flipkart

2. Social Media Platforms


► Social media applications use ROA to manage user profiles, posts, comments, likes, and messages.
► User accounts
► Posts
► Photos,Friend lists, Example: Facebook, Instagram
► 3. Banking and Financial Systems
► Banks use ROA-based APIs for secure online banking services.
► Account information
► Fund transfers
► Balance enquiry
► Transaction history
► 4. Healthcare Systems
► Hospitals use ROA to manage healthcare resources.
► Patient records
► Doctor information
► Appointment scheduling
► Laboratory reports
► 5. Cloud Computing
► Cloud service providers expose resources through RESTful APIs.
► Virtual machines
► Storage services
► Databases
► File management
► Example: Cloud platforms provide APIs to create, update, and delete cloud
resources.
► 6. Mobile Applications
► Most Android and iOS applications communicate with servers using ROA-based
REST APIs.
► User login
► Profile management
► Data synchronization
► Notifications
SOA vsROA

Feature SOA ROA

Focus Services Resources

Communication SOAP/REST REST

Data Format XML, JSON Mostly JSON

State Can be stateful Stateless

Complexity Higher Simpler

Usage Enterprise integration Web and mobile APIs


TOPIC 5 :API Architecture

Definition
An API (Application Programming Interface) Architecture defines how software
applications communicate using standardized interfaces.
Types of APIs
1. Public APIs
2. Private APIs
3. Partner APIs
4. Composite APIs
Public APIs

► Public APIs (also known as Open APIs or External APIs) are publicly available
to any external developer or business.
► Accessibility: Completely open or requiring minimal registration.
► Security: Often uses public standards like OAuth or basic API keys to track
usage.
► Purpose: Designed to drive innovation, maximize market reach, and expand a
company's software ecosystem.
► Examples: The Google Maps API used to embed maps or the Stripe API used
for open web payments
Private APIs

► Private APIs (also known as Internal APIs) are completely hidden from the
public and are used exclusively within an organization.
► Accessibility: Restricted strictly to internal company developers.
► Security: Governed by strict internal firewalls and proprietary access
credentials.
► Purpose: Built to bridge internal systems, connect data silos, or tie together
company microservices.
► Examples: Connecting a human resources tool to a separate payroll database
Partner APIs

► Partner APIs are shared exclusively with strategic, pre-approved business partners under a
formal agreement.

► Accessibility: Locked to the public but open to verified external B2B collaborators.

► Security: Requires strict authentication, specialized permission licenses, or onboarding


procedures.

► Purpose: Facilitates direct software integration between two cooperative business entities.

► Examples: Amazon connecting its inventory management systems with its certified
third-party shipping carriers.
Composite APIs
► Composite APIs combine multiple individual API endpoints into a single, unified
request and response execution.

► Accessibility: Dependent on the underlying endpoints (can be public, private, or


partner).

► Execution: Triggers a sequence of interrelated tasks on multiple servers


simultaneously.

► Purpose: Minimizes data traffic, optimizes system speed, and prevents complex
multi-step network lag.

► Examples: An e-commerce checkout system where one click simultaneously creates


an order, bills the card, and updates warehouse stock.
Continued..

Components
► Client
► API Gateway
► Authentication
► Business Logic
► Database
API Request Flow

Client

API Gateway

Authentication

Application Server

Database
API Styles
► REST API
► Uses HTTP
► JSON data format
► Stateless
► Most commonly used
► SOAP API
► Uses XML
► Strict standards
► High security
► Enterprise applications
► GraphQL API
► Client requests only required data
► Reduces over-fetching
► Flexible queries
• Advantages
► Easy integration
► Faster development
► Reusability
► Better interoperability
► Disadvantages
► Security risks if not protected
► Version management challenges
► Performance depends on network
Applications of API Architecture
► 1. Web Applications
► API architecture is widely used in web applications to connect the frontend with
backend services.
► Examples:
► User authentication
► Product search
► Online forms
► Content management

► 2. Mobile Applications
► Mobile apps use APIs to communicate with servers and retrieve or update data.
► Examples:
► User login
► Profile management
► 3. E-Commerce Platforms
► APIs integrate different services in online shopping systems.
► Examples:
► Product catalog
► Payment gateways
► Order management
► Inventory management
► Shipping and tracking
4. Banking and Financial Services
► Banks use APIs to provide secure online financial services.
► Examples:
► Balance enquiry
► Fund transfer
► Transaction history
► Mobile banking
► 5. Cloud Computing
► Cloud providers offer APIs for managing cloud resources.
► Examples:
► Virtual machine creation
► Cloud storage
► Database management
► User access control

► 6. Social Media Integration


► APIs allow applications to connect with social media platforms.
► Examples:
► Login using social accounts
► Sharing posts
► Uploading photos
► 7. Healthcare Systems
► Healthcare applications use APIs to exchange medical information securely.
► Examples:
► Electronic Health Records (EHR)
► Appointment scheduling
► Laboratory reports
► Prescription management

► 8. Internet of Things (IoT)


► APIs enable communication between smart devices and cloud platforms.
► Examples:
► Smart homes
► Smart watches
► Smart sensors
► Industrial automation
► 9. Travel and Booking Systems
► Travel applications use APIs to provide real-time booking and reservation services.
► Examples:
► Flight booking
► Hotel reservation
► Railway ticket booking
► Cab booking
► 10. Educational Platforms
► Educational institutions use APIs to integrate learning systems.
► Examples:
► Student management
► Online examinations
► Learning Management Systems (LMS)
► Result publication
► 11. Payment Systems
► API architecture enables secure online payment processing.
► Examples:
► Credit/Debit card payments
► UPI payments
► Digital wallets
► Payment verification

► 12. Enterprise Applications


► Organizations use APIs to connect different business systems.
► Examples:
► Customer Relationship Management (CRM)
► Enterprise Resource Planning (ERP)
► Human Resource Management (HRM)
TOPIC 6 : Microservices
Architecture

Definition
Microservices Architecture is an architectural style where an application is divided into
small, independent services that communicate through APIs.
Characteristics
► Independent deployment
► Decentralized data management
► Loosely coupled services
► Business capability-based services
► Continuous delivery support
Architecture Diagram

Client
|
API Gateway
/ | \
User Service Product Service Order Service
| | |
User DB Product DB Order DB
Continued..

Features
► Independent services
► Separate databases
► Fault isolation
► Continuous deployment
► Technology independence
Advantages
► High scalability
► Faster deployment
► Easy maintenance
► Better fault tolerance
► Independent development teams
Continued..

Disadvantages
► Complex monitoring
► Network latency
► Distributed transactions
► Increased operational complexity
Applications
► Netflix
► Amazon
► Uber
► Spotify
Example
Example
Applications of Microservices Architecture
► 1. E-Commerce Applications
► Microservices allow different business functions to operate independently.
► Examples:
► User Management Service
► Product Catalog Service
► Shopping Cart Service
► Payment Service
► Order Management Service
► Delivery Tracking Service
► Benefits: Faster development, easy maintenance, and scalability.
► 2. Banking and Financial Systems
► Banks use microservices to separate financial operations into independent services.
► Examples:
► Account Management
► 3. Social Media Platforms
► Large social networking applications use microservices for different features.
► Examples:
► User Profile Service
► News Feed Service
► Messaging Service
► Notification Service
► Photo Upload Service
► Benefits: Individual services can be updated without affecting the entire application.
► 4. Video Streaming Platforms
► Streaming services use microservices to manage various functionalities.
► Examples:
► User Authentication
► Video Catalog
► Video Streaming
► 5. Healthcare Systems
► Hospitals and healthcare organizations use microservices to manage medical information.
► Examples:
► Patient Records
► Appointment Scheduling
► Laboratory Reports
► Pharmacy Management
► Billing
► Benefits: Secure and scalable healthcare applications.
6. Cloud Computing
► Cloud platforms use microservices to deliver cloud services independently.
► Examples:
► Storage Service
► Virtual Machine Management
► Database Service
► 7. Online Booking Systems
► Travel and reservation applications use microservices for different booking operations.
► Examples:
► Flight Booking
► Hotel Reservation
► Railway Booking
► Payment Processing
► Ticket Cancellation
► Benefits: Faster processing and easier integration.
8. Internet of Things (IoT)
► IoT applications use microservices to process data from connected devices.
► Examples:
► Sensor Data Collection
► Device Monitoring
► Alert Management
► 9. Educational Platforms
► Online learning systems use microservices for educational services.
► Examples:
► Student Management
► Course Management
► Online Examination
► Attendance System
► Certificate Generation
► Benefits: Easy feature updates and improved scalability

► 10. Enterprise Business Applications


► Large organizations use microservices in business applications.
► Examples:
► Customer Relationship Management (CRM)
► Enterprise Resource Planning (ERP)
SOA vs Microservices

Feature SOA Microservices


Size Large services Small services
Database Shared Separate database per service
Communication SOAP, ESB REST, gRPC, Messaging
Deployment Less independent Fully independent
Scalability Moderate High
Coupling Loosely coupled Very loosely coupled
Technology Often standardized Technology independent
ROA vs REST

ROA REST
Architectural style based on resources Architectural principles implementing ROA
Focuses on resources Focuses on resource manipulation
Uses URIs Uses URIs and HTTP methods
Foundation of REST APIs Practical implementation of ROA
Overview

Architecture Main Focus Communication Best Use Case

Enterprise
SOA Business services SOAP, REST
applications

ROA Resources HTTP/REST Web applications

Communication REST, SOAP,


API Architecture System integration
interfaces GraphQL

Cloud-native and
Small independent REST, gRPC,
Microservices scalable
services Messaging
applications
TOPIC 7 :HATEOAS (Hypermedia As
The Engine Of Application State)

► HATEOAS :It is a core constraint of the REST architectural style. It means that
when a client requests data from a server, the server responds with both the
requested information and dynamic links that guide the client on what actions
to take next.
► It means that a client interacts with a REST API entirely through hyperlinks
(hypermedia) provided dynamically by the server.
► Key Idea
► The server sends data along with links.
► Clients discover available operations by following these links.
► Makes APIs more flexible and self-descriptive.
► Definition
► HATEOAS is a REST principle where the server returns not only the requested
resource but also links to related resources and possible next actions. These
links guide the client through the application.
► How HATEOAS Works
► The client sends a request to the server.
► The server returns the requested resource along with hyperlinks.
► The client follows the hyperlinks to perform the next action.
► The application state changes as the client navigates using the provided links
► Example
► Request:
GET /orders/101

► Response:
In this response:
{

"orderId": 101,
•self → Current order
"status": "Processing", •cancel → Cancel the order
"total": 1500,
•payment → Make payment
"_links": {

"self": {
•customer → View customer details
"href": "/orders/101"

},
The client simply follows these links instead of
"cancel": {

"href": "/orders/101/cancel"
constructing URLs manually.
},

"payment": {

"href": "/orders/101/payment"

},

"customer": {

"href": "/customers/25"

}
Example
► Request
► GET /students/101
Response
{
"id": 101,
"name": "John",
"department": "CSE",
"_links": {
"self": "/students/101",
"update": "/students/101",
"delete": "/students/101",
"courses": "/students/101/courses"
}
}
Advantages
• Easy API navigation
• Loose coupling between client and server
• Better API evolution
• Self-documenting APIs
Disadvantages
• More complex implementation
• Larger response size due to links
• Not supported by every REST API
Applications
• RESTful APIs
• Enterprise applications
• Cloud-based services
TOPIC 8 : REST (Representational
State Transfer)
It is an architectural style for designing web services that uses standard HTTP
methods to access and manipulate resources.
REST Principles
[Link]–Server Architecture
[Link] Communication
[Link] Responses
[Link] Interface
[Link] System
[Link] on Demand (Optional)
HTTP Methods
Method Purpose
GET Retrieve data
POST Create new data
PUT Update existing data
PATCH Partially update data
DELETE Delete data
REST Architecture

Client
|
HTTP Request
|
REST API Server
|
Database
|
HTTP Response (JSON/XML)
Characteristics
• Stateless
• Resource-based
• Lightweight
• Uses HTTP
• Supports JSON and XML
Advantages
• Simple and scalable
• Platform independent
• Fast communication
• Easy integration
Disadvantages
• Stateless communication may require repeated authentication
• Less suitable for very complex transactions
Applications
• Mobile applications
• Web applications
• Cloud computing
• IoT systems
TOPIC 9 : URI (Uniform Resource
Identifier)

Definition
A URI (Uniform Resource Identifier) is a unique identifier used to identify a
resource on the internet.
Types of URI
1. URL (Uniform Resource Locator)
Specifies both the resource and its location.
Example:
[Link]
URN (Uniform Resource Name)

Identifies a resource by name instead of location.


Example:
urn:isbn:9780134685991
Structure of a URI
[Link]
│ │ │
│ │ └── Resource Path
│ └──────────── Domain
└──────────────────── Protocol
Characteristics
• Unique identification
• Human-readable
• Supports hierarchical structure
• Used in REST APIs
Advantages
• Easy resource identification
• Improves API organization
• Platform independent
Applications
• Web services
• REST APIs
• Web pages
• Cloud services
TOPIC 10 :Code on Demand

Definition
Code on Demand is an optional REST constraint where the server sends executable code to the
client, allowing the client to extend its functionality dynamically.
How It Works
• The server sends executable code (such as JavaScript).
• The client downloads and executes the code.
• New functionality is added without changing the client application.
Example
A browser requests a webpage.
The server responds with:
• HTML
• CSS
• JavaScript
Architecture

Client
|
Request
|
Server
|
HTML + CSS + JavaScript
|
Client Executes Code
Advantages
• Reduces client updates
• Dynamic functionality
• Better user experience
• Lower server load for some interactions
Disadvantages
• Security concerns
• Increased client complexity
• Browser compatibility issues
Applications
• Web browsers
• Single Page Applications (SPA)
• Interactive websites
• Dynamic web applications
Comparison: REST vs HATEOAS

Feature REST HATEOAS

Architectural style for web REST constraint using


Definition
services hypermedia links

Main Focus Resource communication API navigation


Uses Hyperlinks Optional Yes

Discovers endpoints
Client Knowledge Knows endpoints
dynamically

Flexibility High Very high


JSON
► JSON stands for JavaScript Object Notation.
► It is a lightweight, text-based data format used to store and exchange structured
information
► Key Characteristics of JSON
► Language-Independent: Although originally derived from JavaScript, JSON is
plain text and can be read and written by almost any programming language,
including Python, Java, C++, and PHP.
► Human and Machine Readable: It is structured in a way that is intuitive for
humans to read while remaining incredibly easy for computer systems to parse and
generate
JSON data is primarily written in two ways:

[Link]: A collection of key-value pairs enclosed in curly braces {}.

[Link] key must be a string, and the value can be a string, number, array, boolean, or null.

[Link]: An ordered list of values enclosed in square brackets

► JSON is often used when data is sent from a server to a web page
► JSON is "self-describing" and easy to understand
► [Link] -- REFERENCE
THANK YOU

You might also like