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

What Is REST and REST API-compressed

REST is an architectural guideline for developing Web APIs, known as REST APIs or RESTful APIs. It outlines how clients interact with a web application and database through HTTP requests to perform CRUD operations. The document provides examples of API requests and responses for managing student data, including creating, reading, updating, and deleting records.
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 views12 pages

What Is REST and REST API-compressed

REST is an architectural guideline for developing Web APIs, known as REST APIs or RESTful APIs. It outlines how clients interact with a web application and database through HTTP requests to perform CRUD operations. The document provides examples of API requests and responses for managing student data, including creating, reading, updating, and deleting records.
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

REST

It is an architectural guideline to develop Web API.


REST API
The API which is developed using REST is known as REST API / RESTful
API.
REST Web API
Web Application

Database
How REST Web API Works

Web API

Database
Web Application

• Client makes HTTP Request to API


• API will communicate to Web Application/Database (If needed)
• Web Application/Database provides required data to API
• API returns Response Data to Client

Note – Json Data, XML Data


REST API
CRUD Operations:-

Operation HTTP Methods Description


Create POST Creating/Posting/Inserting Data
Read GET Reading/Getting/Retrieving Data
Updating Data
Update PUT, PATCH Complete Update - PUT
Partial Update - PATCH
Delete DELETE Deleting Data
Students API Resource
[Link]

1 2 3

1. Base URL
2. Naming Convention
3. Resource of API or End-Point
Request - Response
• Request for All Students

Response

Request [
{"id":1, "name": "Rahul"},
GET: /api/students {"id":2, "name" : "Sonam"},
….
]
Request - Response
• Request for One Student having id = 1

Response
Request
[
GET: /api/students/1 {"id":1, "name": "Rahul" }
]
Request - Response
• Request Posting/Creating/Inserting Data

Request
Response
POST: api/students
{"id":11, "name": “Sumit”}
{"name": “Sumit"}
Request - Response
• Request for Updating Data, id = 1

Response
Request
[
PUT or PATCH: /api/students/1 {"id":1, "name": "Raj" }
]
{"name": “Raj" }
Request - Response
• Request for Deleting Data, id = 1

Request Response

DELETE: /api/students/1 {"id":1, "name": "Raj" }


RESTful API
[Link]

GET /api/students
GET /api/students/1
POST /api/students
PUT /api/students/1
PATCH /api/students/1
DELETE /api/students/1

You might also like