Skip to main content

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

MethodOperation (CRUD)DescriptionExample
GETReadRetrieve a resource or list; safe and idempotentGET /students/5
POSTCreateCreate a new resource; not idempotentPOST /students
PUTUpdate / replaceReplace a resource completely; idempotentPUT /students/5
PATCHPartial updateChange only some fieldsPATCH /students/5
DELETEDeleteRemove a resource; idempotentDELETE /students/5
HEADRead headersSame as GET but returns only the headers, no bodyHEAD /students/5
OPTIONSDiscoverLists the methods allowed for a resourceOPTIONS /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)

All Web Technology chapter 8 questions →