What is HTTP method?

The word in an HTTP request that states the operation to perform on a resource. Examples are GET (retrieve), HEAD (retrieve the headers only), POST (process or create), PUT (replace), PATCH (partially update), DELETE (delete) and OPTIONS (ask which features are available). A method that does not change the server's state is called "safe", and one that leaves the same state however many times it is sent as when it is sent once is called "idempotent". GET is safe and idempotent, PUT and DELETE are idempotent but not safe, and POST is in general neither.

Japanese name: HTTPメソッド

HTTP method appears in 2 practice questions across 1 topic, including Web Technology Basics.

Field: Web Technology Basics

Try it: questions about HTTP method

Among HTTP methods, which of the following is not "safe" (not intended to change the state of resources on the server) but is "idempotent" (sending the same request any number of times leaves the same state as sending it once)?

  1. AGET
  2. BPOST
  3. CPUT
Show answer and explanation

Answer: C. PUT

GET and HEAD are safe methods that only read resources, and safe methods are also idempotent. PUT replaces the state of the specified resource with the content sent, so sending it any number of times gives the same result as sending it once: it is idempotent but not safe. DELETE is likewise idempotent. POST may create a new order or post each time it is sent, so it is generally not idempotent, and PATCH is not necessarily idempotent either. An idempotent request has the advantage that it can simply be resent when a communication failure leaves the result unknown, with little risk of problems.

HTTP method in the explanations

Questions that mention HTTP method (2)

  1. Among HTTP methods, which of the following is not "safe" (not intended to change the state of resources on the server) but is "idempotent" (sending the same request any number of times leaves the same state as sending it once)?
  2. Which of the following is an appropriate web API design that follows the principles of REST?

Books on Web Technology Basics Ad

As an Amazon Associate I earn from qualifying purchases.

Related terms

REST API Cookie (HTTP cookie) CORS (cross-origin resource sharing) DOM (Document Object Model) Event loop HTTP (Hypertext Transfer Protocol) HTTP status code JSON (JavaScript Object Notation) JWT (JSON Web Token) OAuth

Back to the glossary