Chapter 7
Chapter 7
Chapter 7:
Cloud System
• A communications protocol for transmitting
hypermedia documents, such as HTML.
• Designed for communication between web
browsers and web servers.
GET /index.html HTTP/1.1
Host: www.google.com
Browser Web Server
HTTP/1.1 200 OK
Content-Type: text/html
<html><head>…
HTTP/1.1 200 OK
Content-Type: text/html
<html><head>…
HTTP/1.1 200 OK
Content-Type: text/html
<html><head>…
response
HTTP/1.1 200 OK
Content-Type: text/html
<html><head>…
The Endpoint
• The methods provide meaning for the request to
perform four basic actions: Create, Read, Update
and Delete (CRUD):
• GET : Read Request
• POST : Create Request
• DELETE : Delete Request
• PATCH : Update Request
GET http://benr2423.com/books
Retrieve all books
HTTP GET
• This request is used to create a new resource on a
server.
• If you perform a POST request, the server creates a
new entry in the database and tells you whether the
creation is successful.
• In general, a POST request performs an CREATE
operation.
POST http://benr2423.com/student
body: { name: 'Soo', matric: 'B0201110011’}
Create a new student
HTTP POST
• This request is used to update a resource on a server.
• If you perform a PATCH request, the server updates an
entry in the database and tells you whether the update
is successful.
• In general, a PATCH request performs an UPDATE
operation.
PATCH http://benr2423.com/student/B0201110011
body: { name: 'Soo YG', matric: 'B0201110011'}
Update student info with matric B0201110011
HTTP PATCH
• This request is used to delete a resource from a
server.
• If you perform a DELETE request, the server deletes
an entry in the database and tells you whether the
deletion is successful.
• In other words, a DELETE request performs a
DELETE operation.
DELETE http://benr2423.com/student/B0201110011
Delete student with matric B0201110011
HTTP DELETE
• Headers are used to provide information to both
the client and server.
• It can be used for many purposes, such as
authentication and providing information about the
body content.
• References:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
The Headers
• The data (sometimes called body or message)
contains information you want to be sent to the
server.
• This option is only used with POST, PATCH or
DELETE requests
REST API
• HTTP status codes let you tell the status of the
response quickly.
• The range from 100+ to 500+. In general, the
numbers follow the following rules:
• 200+ means the request has succeeded.
• 300+ means the request is redirected to another URL
• 400+ means an error that originates from the client has
occurred
• 500+ means an error that originates from the server has
occurred