0% found this document useful (0 votes)
12 views

REST API

The document provides an overview of web services, defining them as client-server applications for communication and detailing two main types: SOAP and RESTful web services. It explains the characteristics and differences between SOAP, which is a protocol, and REST, which is an architectural style, highlighting their respective advantages and use cases. Additionally, it outlines common HTTP methods used in RESTful architecture, including POST, GET, PUT, PATCH, and DELETE, along with their functionalities.

Uploaded by

Dhiraj Patil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

REST API

The document provides an overview of web services, defining them as client-server applications for communication and detailing two main types: SOAP and RESTful web services. It explains the characteristics and differences between SOAP, which is a protocol, and REST, which is an architectural style, highlighting their respective advantages and use cases. Additionally, it outlines common HTTP methods used in RESTful architecture, including POST, GET, PUT, PATCH, and DELETE, along with their functionalities.

Uploaded by

Dhiraj Patil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Reva Tech Software Solution

API
API stands for application program interface

What is Web Service

A Web Service is can be defined by following ways:

1. It is a client-server application or application component for communication.


2. The method of communication between two devices over the network.
3. It is a software system for the interoperable machine to machine
communication.
4. It is a collection of standards or protocols for exchanging information between
two devices or application.

Types of Web Services

There are mainly two types of web services.

1. SOAP web services.

2. RESTful web services.

Documented By Reva Tech Software Solution (7972590331)


Reva Tech Software Solution
SOAP Web Services

1. SOAP stands for Simple Object Access Protocol. It is a XML-based


protocol for accessing web services.
2. SOAP is a W3C recommendation for communication between two
applications.
3. SOAP is XML based protocol. It is platform independent and language
independent. By using SOAP, you will be able to interact with other
programming language applications.

RESTful Web Services

1. REST stands for REpresentational State Transfer.


2. REST is an architectural style not a protocol.
3. Representational State Transfer (REST) is an architectural style that defines a
set of constraints to be used for creating web services. REST API is a way of
accessing web services in a simple and flexible way without having any
processing.
4. REST technology is generally preferred to the more robust Simple Object
Access Protocol (SOAP) technology because 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. All communication done
via REST API uses only HTTP request.

No. SOAP REST

1) SOAP is a protocol. REST is an architectural style.

2) SOAP stands for Simple REST stands for REpresentational State


Object Access Protocol. Transfer.

3) SOAP can't use REST can use SOAP web services because
REST because it is a it is a concept and can use any protocol
protocol. like HTTP, SOAP.

4) SOAP uses services REST uses URI to expose business logic.


interfaces to expose the
business logic.

5) JAX-WS is the java API for JAX-RS is the java API for RESTful web
SOAP web services. services.

Documented By Reva Tech Software Solution (7972590331)


Reva Tech Software Solution

6) SOAP defines standards to REST does not define too much standards
be strictly followed. like SOAP.

7) SOAP requires more REST requires less bandwidth and


bandwidth and resource resource than SOAP.
than REST.

8) SOAP defines its own RESTful web services inherits security


security. measures from the underlying transport.

9) SOAP permits XML data REST permits different data format such
format only. as Plain text, HTML, XML, JSON etc.

10) SOAP is less preferred than REST more preferred than SOAP.
REST.

In HTTP there are five methods that are commonly used in a REST-based
Architecture i.e., POST, GET, PUT, PATCH, and DELETE. These correspond to
create, read, update, and delete (or CRUD) operations respectively. There are other
methods which are less frequently used like OPTIONS and HEAD.

GET: The HTTP GET method is used to read (or retrieve) a representation of a
resource. In the safe path, GET returns a representation in XML or JSON and an
HTTP response code of 200 (OK). In an error case, it most often returns a 404 (NOT
FOUND) or 400 (BAD REQUEST).

POST: The POST verb is most often utilized to create new resources. In particular,
it’s used to create subordinate resources. That is, subordinate to some other (e.g.
parent) resource. On successful creation, return HTTP status 201, returning a
Location header with a link to the newly-created resource with the 201 HTTP status

NOTE: POST is neither safe nor idempotent.

PUT: It is used for updating the capabilities. However, PUT can also be used to
create a resource in the case where the resource ID is chosen by the client instead
of by the server. In other words, if the PUT is to a URI that contains the value of a
non-existent resource ID. On successful update, return 200 (or 204 if not returning

Documented By Reva Tech Software Solution (7972590331)


Reva Tech Software Solution
any content in the body) from a PUT. If using PUT for create, return HTTP status 201
on successful creation. PUT is not safe operation but it’s idempotent.

PATCH: It is used to modify capabilities. The PATCH request only needs to contain
the changes to the resource, not the complete resource. This resembles PUT, but
the body contains a set of instructions describing how a resource currently residing
on the server should be modified to produce a new version. This means that the
PATCH body should not just be a modified part of the resource, but in some kind of
patch language like JSON Patch or XML Patch. PATCH is neither safe nor
idempotent.

DELETE: It is used to delete a resource identified by a URI. On successful deletion,


return HTTP status 200 (OK) along with a response body.

Documented By Reva Tech Software Solution (7972590331)

You might also like