liveBook · Manning

HTTP method

As explained in The Design of Web APIs, Second Edition

An HTTP method is a standardized operation indicator that specifies the intended action on an HTTP resource.

An HTTP method is a standardized operation indicator applied to a resource path. It tells a client and server what kind of interaction an HTTP request intends, independently of programming languages or implementation technologies. section 3.1.1 section 3.1.2

Choose a method by matching the resource action:

  • Use GET to read, search, filter, retrieve, show, or download a resource. section 4.3.1
  • Use POST commonly to create, add, start, save, or send; more broadly, it processes an action according to the resource’s meaning. section 4.3.1
  • Use PUT for replacement, update, creation, or upsert; use PATCH for updates that generally send only modified data. section 4.3.1
  • Use DELETE for deletion and related actions such as cancel, close, finish, or stop. section 4.3.1

Searching a product catalog

A mobile application can search for Blu-ray products with GET /products?type=BD. GET represents the search action, /products identifies the catalog resource, the query parameter supplies a filter, and a successful response returns matching products with 200 OK. section 4.1.1

Design the method after identifying the resource, its action, inputs, and outputs. Represent the resource with a meaningful path, select the standard method that fits the action, then place inputs and outputs in appropriate request and response locations. A method conflict usually signals that the resource or operation needs reconsideration. section 4.1.2 section 4.3.2

Figure 4.8 Refer to this mapping when in doubt about choosing an HTTP method for an action. CRUD stands for create, read, update, delete.
figure

Use the method mapping as a quick reference when translating create, read, update, and delete actions into HTTP operations. section 4.3.1

How The Design of Web APIs, Second Edition covers it

How deep it goes
Explains five common methods, action-matching recipes, request placement, and method conflicts, while deferring safe and idempotent behavior.
Examples
Uses GET /blog, GET /products?type=BD, product-catalog mappings, and a translation-operation exercise.
What it assumes
Assumes identifying resources and actions, while introducing HTTP request-response interaction and REST method selection.
What you can do after
Apply it to design guessable, interoperable API operations with meaningful paths and appropriate standard methods.
How it connects
Connects HTTP methods with REST APIs, resource paths, CRUD operations, HTTP status codes, request data, and response data.

Also explained in

Compare how 10 books explain HTTP method →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Design of Web APIs, Second Edition. The section links point to the parts of the book it draws on.