- 2076 Chaitra · 2+3 marks
REST and its HTTP methods
Short answer
REST is an architectural style for web services where resources are identified by URIs and manipulated via representations using standard HTTP. The HTTP methods include GET (read), POST (create), PUT (replace), PATCH (partial update), DELETE (remove), HEAD (read headers), and OPTIONS (discover allowed methods), each with standard semantics and status codes.
What is REST? Mention the HTTP methods supported by REST.
REST
REST (Representational State Transfer) is an architectural style, proposed by Roy Fielding (2000), for building web services. Every piece of information is a resource identified by a URI (such as /students/5). Clients use standard HTTP methods to get or change a representation (JSON, XML) of the resource. It is stateless, client-server, cacheable and layered, and has a uniform interface.
Client --HTTP GET /students/5--> REST server
Client <-- 200 OK, JSON -------- (database)
HTTP methods used by REST
| Method | Operation (CRUD) | Description | Example |
|---|---|---|---|
| GET | Read | Retrieve a resource or list; safe and idempotent | GET /students/5 |
| POST | Create | Create a new resource; not idempotent | POST /students |
| PUT | Update / replace | Replace a resource completely; idempotent | PUT /students/5 |
| PATCH | Partial update | Change only some fields | PATCH /students/5 |
| DELETE | Delete | Remove a resource; idempotent | DELETE /students/5 |
| HEAD | Read headers | Same as GET but returns only the headers, no body | HEAD /students/5 |
| OPTIONS | Discover | Lists the methods allowed for a resource | OPTIONS /students |
Responses use status codes such as 200 OK, 201 Created, 204 No Content, 400 Bad Request, 404 Not Found and 500 Internal Server Error.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Conjugate beam: stepped rigidity, central load · Theory of Structures I, chapter 4