0% found this document useful (0 votes)
7 views2 pages

Rest Api

The document outlines the principles of REST APIs, including HTTP methods for managing resources such as books. It details the HTTP status codes associated with various operations and provides a project example for designing a REST API for a book resource. The key operations include fetching all books, retrieving a book by ID, and adding a new book, along with their corresponding HTTP methods and expected responses.

Uploaded by

meghsingh6069
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)
7 views2 pages

Rest Api

The document outlines the principles of REST APIs, including HTTP methods for managing resources such as books. It details the HTTP status codes associated with various operations and provides a project example for designing a REST API for a book resource. The key operations include fetching all books, retrieving a book by ID, and adding a new book, along with their corresponding HTTP methods and expected responses.

Uploaded by

meghsingh6069
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 API

03 August 2025 10:43

REST => Representational state transfer.

Note: REST APIs expose resource via http endpoints like

1. Get /products
2. Post /products
3. Get /product/{id} Model & View
4. PUT /product/{id}
5. DELETE /product/{id}
6. PATCH /product/{id}

Understanding HTTP status code:

200 OK -> Success(Get, Put, Delete)


201 Created -> Succes(POST)
204 No content -> success without response body
400 Bad Request -> client error ( invalid input) -> missing field, validation error
401 Untheorized -> Not Authenticated
403 Forbidden -> Authenticated but no access
404 Not found -> resource not found
500 Internal server error - > server-side bug

Project : Design Rest API for a boot resource.


--------------------------------------------------------------
Entity : Book

Book :
-id
-title
-author
-price

Define restful points


---------------------------

Operation Http Methods Url Des


Get all books GET /books Fetch list of all books: 200 ok
Get a book by ID GET /book{id} Fetch a single book : 200 OK, 404
Add new book POST /books Create new Book : 201 created, 404

[Link]/courses/

New Section 1 Page 1


Json to java object

response

New Section 1 Page 2

You might also like