liveBook · Manning

HTTP method

As explained in API Design Patterns

An HTTP method is a standardized request action indicating how an HTTP client intends to interact with a resource.

An HTTP method is a standardized request action that tells a client how it intends to interact with a resource. Standard methods make APIs more predictable: users learn a small action set once and apply it across resources. section 1.3 section 7.0

Apply the standard method whose behavior matches the requested resource operation:

  • Get retrieves an existing resource. section 7.2
  • List returns a collection of resources. section 7.2
  • Create makes a new resource. section 7.2
  • Update changes an existing resource, while Replace substitutes the entire resource. section 7.2
  • Delete removes an existing resource. section 7.2

Standardization requires consistent behavior, not merely familiar names. Support each method unless the resource provides a documented reason not to; return 405 when the method is unsupported for the resource type, rather than implying that the resource is missing with 404. Distinguish unsupported methods from instance-specific permission failures, which correspond to 403. section 7.3.1 section 7.0

Keep standard methods limited to their stated operation. Repeated identical requests should preserve the method’s defined idempotence properties, and implementations should avoid unrelated side effects. For example, creating and storing an email belongs to Create, while sending it through SMTP is an additional side effect. section 7.3.2 section 7.6

Chat room API

A ChatRoom API can expose CreateChatRoom with POST /chatRooms, GetChatRoom and ListChatRooms with GET, UpdateChatRoom with PATCH, ReplaceChatRoom with PUT, and DeleteChatRoom with DELETE. Child messages use POST to create and GET to list them under a chat room. section 7.3.9

Use custom methods only for genuinely nonstandard interactions after checking the resource layout. A proliferation of custom methods for ordinary actions often signals that the resources or their relationships are poorly modeled. section 9.4

Table 7.1 Standard methods overview (view table figure)

Name

Behavior

Example

Get

Retrieves an existing resource

GetChatRoom()

List

Lists a collection of resources

ListChatRooms()

Create

Creates a new resource

CreateMessage()

Update

Updates an existing resource

UpdateUserProfile()

Delete

Removes an existing resource

DeleteChatRoom()

Replace

Replaces an entire resource

ReplaceChatRoom()

Compare each standard method’s behavior with a concrete ChatRoom example. section 7.2

How API Design Patterns covers it

How deep it goes
Defines six standard operations and descends into support rules, status-code distinctions, idempotence, side effects, and trade-offs.
Examples
Uses flight reservations, ChatRoom and Message resources, singleton sub-resources, association resources, and email creation with SMTP sending.
What it assumes
Assumes basic API and resource concepts while teaching the method pattern, supported-operation decisions, and behavioral constraints.
What you can do after
Apply standard methods to design predictable resource operations, choose HTTP verbs, distinguish failures, and avoid unintended side effects.
How it connects
Connects resource-oriented APIs, REST, HTTP status codes, idempotence, side effects, custom methods, and resource modeling.

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 API Design Patterns. The section links point to the parts of the book it draws on.