---
title: "REST and its HTTP methods"
subject: "Web Technology"
chapter: 8
key: "semester_7/web_technology:rest-http-methods"
source: https://www.bctengineer.com/q/semester_7/web_technology/rest-http-methods
site: BCT Engineering
---

# REST and its HTTP methods

Web Technology · Chapter 8: Web services

- Asked in: 2076 Chaitra, 2+3 marks
- Video: [REST Web Services 05 - HTTP Methods](https://www.youtube.com/watch?v=AK6TulIASgQ) — Java Brains
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/web_technology/rest-http-methods
- Whole chapter: https://www.bctengineer.com/md/semester_7/web_technology/chapter-8

## Question

What is REST? Mention the HTTP methods supported by REST.

## 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.

## Answer

#### 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.

```text
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.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. In REST, what is a resource?
   A. A piece of information identified by a URI, such as /students/5
   B. A server hardware unit
   C. An XML envelope
   D. A database password
   Answer: A. Every piece of information is a resource identified by a URI, and clients get or change its representation. (Key point: Resources in REST)

2. What is the difference between PUT and PATCH?
   A. PUT changes only some fields; PATCH replaces completely
   B. PUT replaces a resource completely; PATCH changes only some fields
   C. Both delete the resource
   D. PUT is for reading; PATCH is for creating
   Answer: B. PUT replaces the resource entirely while PATCH makes a partial update. (Key point: PUT vs PATCH)

3. Which method is used to create a new resource and is NOT idempotent?
   A. GET
   B. DELETE
   C. PUT
   D. POST
   Answer: D. POST creates a new resource each time, so repeating it is not idempotent. (Key point: Idempotence of POST)

4. Which method lists the methods allowed for a resource?
   A. HEAD
   B. OPTIONS
   C. GET
   D. PATCH
   Answer: B. OPTIONS discovers allowed methods; HEAD is GET without a body. (Key point: OPTIONS and HEAD)

## Related in other subjects

- [Conjugate beam: stepped rigidity, central load](https://www.bctengineer.com/question.md?key=semester_4%2Ftheory_of_structures_i%3Ass-beam-stepped-flexural-rigidity) — Theory of Structures I, chapter 4
