ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
REST library
By M.Sivani
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.
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.
Working: A request is sent from client to server in the form of a web
URL as HTTP GET or POST or PUT or DELETE request. After that, a
response comes back from the server in the form of a resource which
can be anything like HTML, XML, Image, or JSON. But now JSON is
the most popular format being used in Web Services.
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 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.
Idempotence: An idempotent HTTP method is a HTTP method that can be
called many times without different outcomes. It would not matter if the method
is called only once, or ten times over. The result should be the same. Again, this
only applies to the result, not the resource itself.
Example:
a=4; //idempotence
a++;//not idempotence
Request and Response
Now we will see how request and response work for different HTTP methods.
Let¡¯s assume we have an API(https://www.geeksforgeeks.org/api/students) for
all students data of gfg.
? GET: Request for all Students.
? POST: Request for Posting/Creating/Inserting Data
Request
GET:/api/student
s
Request
POST:/api/studen
ts
{¡°name¡±:¡±Raj¡±}
?PUT or PATCH: Request for Updating Data at id=1
Request
PUT or
PATCH:/api/students/1
{¡°name¡±:¡±Raj¡±}
?DELETE: Request for Deleting Data of id=1
Request
DELETE:/api/students/1

More Related Content

Similar to REST library.pptx (20)

PPTX
RESTful for opentravel.org by HP
Roni Schuetz
?
PDF
Getting started with DSpace 7 REST API
4Science
?
PDF
Creating Restful Web Services with restish
Grig Gheorghiu
?
PPTX
JAX-RS. Developing RESTful APIs with Java
Jerry Kurian
?
PDF
OpenTravel Advisory Forum 2012 REST XML Resources
OpenTravel Alliance
?
PDF
REST API Basics
Tharindu Weerasinghe
?
PDF
WebApp #3 : API
Jean Michel
?
PPTX
ASP.NET Mvc 4 web api
Tiago Knoch
?
PDF
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
Jitendra Bafna
?
PPTX
Introduction To REST
rainynovember12
?
PDF
ReSTful API Final
Claudine Bruyns
?
PPT
Web Tech Java Servlet Update1
vikram singh
?
PPT
An Introduction To Java Web Technology
vikram singh
?
PDF
RESTful web service with JBoss Fuse
ejlp12
?
PPTX
Best Practices in Api Design
Muhammad Aamir ...
?
PPTX
6 Months Industrial Training in Spring Framework
Arcadian Learning
?
PPT
RESTful SOA - ÖпÆÔºÊîÆÚ½²×ù
Li Yi
?
PDF
[2015/2016] The REST architectural style
Ivano Malavolta
?
PPTX
Restful web services
Surinder Mehra
?
RESTful for opentravel.org by HP
Roni Schuetz
?
Getting started with DSpace 7 REST API
4Science
?
Creating Restful Web Services with restish
Grig Gheorghiu
?
JAX-RS. Developing RESTful APIs with Java
Jerry Kurian
?
OpenTravel Advisory Forum 2012 REST XML Resources
OpenTravel Alliance
?
REST API Basics
Tharindu Weerasinghe
?
WebApp #3 : API
Jean Michel
?
ASP.NET Mvc 4 web api
Tiago Knoch
?
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
Jitendra Bafna
?
Introduction To REST
rainynovember12
?
ReSTful API Final
Claudine Bruyns
?
Web Tech Java Servlet Update1
vikram singh
?
An Introduction To Java Web Technology
vikram singh
?
RESTful web service with JBoss Fuse
ejlp12
?
Best Practices in Api Design
Muhammad Aamir ...
?
6 Months Industrial Training in Spring Framework
Arcadian Learning
?
RESTful SOA - ÖпÆÔºÊîÆÚ½²×ù
Li Yi
?
[2015/2016] The REST architectural style
Ivano Malavolta
?
Restful web services
Surinder Mehra
?

More from MSivani (10)

PPTX
User and operating system interface.pptx
MSivani
?
PPTX
Communication in client server system.pptx
MSivani
?
PPTX
Process scheduling.pptx
MSivani
?
PPTX
Structure of an operating system.pptx
MSivani
?
PPTX
Smart materials.pptx
MSivani
?
PPTX
PROJECT LOON.pptx
MSivani
?
PPTX
Operating System Operations ppt.pptx
MSivani
?
PPTX
How to Install and Set up Android Studio.pptx
MSivani
?
PPTX
Computing Environments.pptx
MSivani
?
PPTX
ppt for phase-1 review-2.pptx
MSivani
?
User and operating system interface.pptx
MSivani
?
Communication in client server system.pptx
MSivani
?
Process scheduling.pptx
MSivani
?
Structure of an operating system.pptx
MSivani
?
Smart materials.pptx
MSivani
?
PROJECT LOON.pptx
MSivani
?
Operating System Operations ppt.pptx
MSivani
?
How to Install and Set up Android Studio.pptx
MSivani
?
Computing Environments.pptx
MSivani
?
ppt for phase-1 review-2.pptx
MSivani
?
Ad

Recently uploaded (20)

PPTX
Diabetes diabetes diabetes diabetes jsnsmxndm
130SaniyaAbduNasir
?
PDF
Plant Control_EST_85520-01_en_AllChanges_20220127.pdf
DarshanaChathuranga4
?
PPTX
Functions in Python Programming Language
BeulahS2
?
PDF
Module - 4 Machine Learning -22ISE62.pdf
Dr. Shivashankar
?
PDF
Authentication Devices in Fog-mobile Edge Computing Environments through a Wi...
ijujournal
?
PPTX
template.pptxr4t5y67yrttttttttttttttttttttttttttttttttttt
SithamparanaathanPir
?
PPSX
OOPS Concepts in Python and Exception Handling
Dr. A. B. Shinde
?
PPTX
Artificial Intelligence jejeiejj3iriejrjifirirjdjeie
VikingsGaming2
?
PPTX
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
?
PDF
William Stallings - Foundations of Modern Networking_ SDN, NFV, QoE, IoT, and...
lavanya896395
?
PDF
June 2025 - Top 10 Read Articles in Network Security and Its Applications
IJNSA Journal
?
PPTX
CM Function of the heart pp.pptxafsasdfddsf
drmaneharshalid
?
PDF
lesson4-occupationalsafetyandhealthohsstandards-240812020130-1a7246d0.pdf
arvingallosa3
?
PDF
Tesia Dobrydnia - An Avid Hiker And Backpacker
Tesia Dobrydnia
?
PPTX
Unit_I Functional Units, Instruction Sets.pptx
logaprakash9
?
PDF
13th International Conference on Artificial Intelligence, Soft Computing (AIS...
ijait
?
PDF
Designing for Tomorrow ¨C Architecture¡¯s Role in the Sustainability Movement
BIM Services
?
PPTX
Computer network Computer network Computer network Computer network
Shrikant317689
?
PPTX
Explore USA¡¯s Best Structural And Non Structural Steel Detailing
Silicon Engineering Consultants LLC
?
PPTX
Engineering Quiz ShowEngineering Quiz Show
CalvinLabial
?
Diabetes diabetes diabetes diabetes jsnsmxndm
130SaniyaAbduNasir
?
Plant Control_EST_85520-01_en_AllChanges_20220127.pdf
DarshanaChathuranga4
?
Functions in Python Programming Language
BeulahS2
?
Module - 4 Machine Learning -22ISE62.pdf
Dr. Shivashankar
?
Authentication Devices in Fog-mobile Edge Computing Environments through a Wi...
ijujournal
?
template.pptxr4t5y67yrttttttttttttttttttttttttttttttttttt
SithamparanaathanPir
?
OOPS Concepts in Python and Exception Handling
Dr. A. B. Shinde
?
Artificial Intelligence jejeiejj3iriejrjifirirjdjeie
VikingsGaming2
?
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
?
William Stallings - Foundations of Modern Networking_ SDN, NFV, QoE, IoT, and...
lavanya896395
?
June 2025 - Top 10 Read Articles in Network Security and Its Applications
IJNSA Journal
?
CM Function of the heart pp.pptxafsasdfddsf
drmaneharshalid
?
lesson4-occupationalsafetyandhealthohsstandards-240812020130-1a7246d0.pdf
arvingallosa3
?
Tesia Dobrydnia - An Avid Hiker And Backpacker
Tesia Dobrydnia
?
Unit_I Functional Units, Instruction Sets.pptx
logaprakash9
?
13th International Conference on Artificial Intelligence, Soft Computing (AIS...
ijait
?
Designing for Tomorrow ¨C Architecture¡¯s Role in the Sustainability Movement
BIM Services
?
Computer network Computer network Computer network Computer network
Shrikant317689
?
Explore USA¡¯s Best Structural And Non Structural Steel Detailing
Silicon Engineering Consultants LLC
?
Engineering Quiz ShowEngineering Quiz Show
CalvinLabial
?
Ad

REST library.pptx

  • 2. 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. 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.
  • 3. Working: A request is sent from client to server in the form of a web URL as HTTP GET or POST or PUT or DELETE request. After that, a response comes back from the server in the form of a resource which can be anything like HTML, XML, Image, or JSON. But now JSON is the most popular format being used in Web Services.
  • 4. 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.
  • 5. ?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 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.
  • 6. 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. Idempotence: An idempotent HTTP method is a HTTP method that can be called many times without different outcomes. It would not matter if the method is called only once, or ten times over. The result should be the same. Again, this only applies to the result, not the resource itself. Example: a=4; //idempotence a++;//not idempotence
  • 7. Request and Response Now we will see how request and response work for different HTTP methods. Let¡¯s assume we have an API(https://www.geeksforgeeks.org/api/students) for all students data of gfg. ? GET: Request for all Students. ? POST: Request for Posting/Creating/Inserting Data Request GET:/api/student s Request POST:/api/studen ts {¡°name¡±:¡±Raj¡±}
  • 8. ?PUT or PATCH: Request for Updating Data at id=1 Request PUT or PATCH:/api/students/1 {¡°name¡±:¡±Raj¡±} ?DELETE: Request for Deleting Data of id=1 Request DELETE:/api/students/1