0% found this document useful (0 votes)
22 views23 pages

Week1 2

The document provides an overview of web services, defining them as software systems that enable machine-to-machine interaction over a network using standard protocols like HTTP, XML, and JSON. It categorizes web services into SOAP and RESTful APIs, detailing the principles and benefits of RESTful APIs, including client-server architecture, statelessness, and cacheability. Additionally, it outlines best practices for RESTful API design, including proper use of HTTP methods and status codes.

Uploaded by

anoh247
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)
22 views23 pages

Week1 2

The document provides an overview of web services, defining them as software systems that enable machine-to-machine interaction over a network using standard protocols like HTTP, XML, and JSON. It categorizes web services into SOAP and RESTful APIs, detailing the principles and benefits of RESTful APIs, including client-server architecture, statelessness, and cacheability. Additionally, it outlines best practices for RESTful API design, including proper use of HTTP methods and status codes.

Uploaded by

anoh247
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

BITW 335

Advanced Web Technology

Lecturer: Mr Anthony K. Emil Jnr


Contact: [Link]@[Link]

FACULTY OF APPLIED SCIENCES


DEPARTMENT OF COMPUTER SCIENCE
Introduction Web Services
• Definition: Web Services are software systems designed to
support interoperable machine-to-machine interaction over
a network.
• Web services are a set of APIs that allow for communication
between different applications over the internet.
• Web services use standard protocols to communicate with
each other, such as HTTP, XML, or JSON.
Web Services
• They provide a common way for applications to access
and exchange information.
• Web services are a way for applications to communicate
with each other over the internet.
• They allow different systems to interact with each other,
regardless of the programming language they are written
in.
Web Services
• Web services use standard protocols to communicate with each other,
such as HTTP, XML, or JSON.

• They provide a common way for applications to access and exchange


information.

• Web services are a way for applications to communicate with each other
over the internet.

• They allow different systems to interact with each other, regardless of the
programming language they are written in.
Types of Web Services
• Definition: Web services can be classified into two main categories:
SOAP and RESTful API.
• Explanation: SOAP is a protocol for exchanging structured information
in the implementation of web services, while RESTful API uses HTTP
requests to communicate with web services.
RESTful API
• Definition: RESTful API is a type of web service that
uses REST architecture.
• Explanation: REST stands for Representational State
Transfer, which is a style of software architecture for
building scalable web services
Benefits of RESTful API
• Easy to use and understand
• Scalable
• Supports multiple data formats
• Can be used with any programming language
• Stateless communication
RESTful API Design Principles
• Definition: RESTful API design principles include client-server
architecture, statelessness, cacheability, and layered system.
• Explanation: RESTful API adheres to these design principles to make
sure the API is scalable, maintainable, and flexible.
RESTful API design principles
• RESTful APIs are based on Representational State Transfer (REST)
architecture style.
• RESTful APIs use HTTP requests to POST (create), PUT (update), GET
(read), and DELETE (delete) data.
• RESTful API design follows six principles: client-server, statelessness,
cacheability, layered system, uniform interface, and code on demand.
Client-Server Architecture
• Definition: Client-Server Architecture is the separation of concerns
between the client and the server.
• Explanation: In RESTful API, the client is responsible for making
requests and receiving responses, while the server is responsible for
processing the request and providing a response.
Statelessness
• Definition: Statelessness means that each request from the client to
the server must contain all of the information necessary to
understand the request, and cannot take advantage of any stored
context on the server.
• Explanation: Statelessness is important in RESTful API design because
it allows for the API to be more scalable and maintainable
Cacheability
• Definition: Cacheability means that responses from the server should
be explicitly cacheable or non-cacheable.
• Explanation: Cacheability is important in RESTful API design because it
allows for the API to be more efficient and improve the user
experience.
Layered System
• Definition: A layered system is a set of layers where each
layer only communicates with the layer directly above or
below it.
• Explanation: Layered system is important in RESTful API
design because it allows for the API to be more scalable and
maintainable.
RESTful API Design Principles
(Continued)
• Code on Demand: Servers can send executable code to clients, allowing
for improved customization and personalization of the application.
• Uniform Interface: A consistent interface between clients and servers
reduces coupling, improving the overall maintainability and scalability of
the application.
• Resource-Oriented: Resources are identified and manipulated through
URIs, allowing for easy discovery and linking between resources.
• Representations: Resources can have multiple representations, allowing
for the same resource to be accessible through different media types,
such as HTML, XML, or JSON.
RESTful API Best Practices
• Use proper HTTP methods for each request
• Return proper HTTP status codes
• Use HATEOAS (Hypermedia as the Engine of Application State)
• Versioning of the API
• Use proper error handling and logging.
HTTP Methods
• HTTP (Hypertext Transfer Protocol) is the underlying protocol used by the
World Wide Web.
• HTTP defines a set of methods to indicate the desired action to be
performed on the identified resource.
• The most common HTTP methods are:
• GET - Retrieve a representation of a resource.
• POST - Submit data to be processed by the resource identified by the URI.
• PUT - Update a current resource with new data.
• DELETE - Delete a specified resource.
• These HTTP methods are used in RESTful APIs to perform various actions
on resources.
HTTP Methods
• Definition: HTTP Methods are used in RESTful API to
indicate the desired action to be performed on a
specific resource.
• Explanation: There are four main HTTP methods: GET,
POST, PUT, and DELETE.
GET Method
• Definition: The GET method is used to retrieve
data from a server.
• Explanation: The GET method is used to retrieve
data from a specific resource.
POST Method
• Definition: The POST method is used to submit
data to a server for processing.
• Explanation: The POST method is used to create
a new resource on the server.
PUT Method
• Definition: The PUT method is used to update
data on a server.
• Explanation: The PUT method is used to update
an existing resource on the server.
DELETE Method
• Definition: The DELETE method is used to delete
data from a server.
• Explanation: The DELETE method is used
HTTP Status Codes
• 200 OK: The request was successful.
• 201 Created: The request was successful and a new resource was created.
• 204 No Content: The request was successful, but there is no representation
to return.
• 400 Bad Request: The request was invalid or cannot be served.
• 401 Unauthorized: The request requires user authentication.
• 403 Forbidden: The server understood the request, but it refuses to
authorize it.
• 404 Not Found: The requested resource could not be found.
• 500 Internal Server Error: An error occurred on the server.

You might also like