liveBook · Manning

HTTP method

As explained in Django in Action

An HTTP method is a standardized operation token indicating the intended action for an HTTP request.

An HTTP method is the action label attached to a request between a client and a web server. In a REST-style API, URLs identify the nouns—such as a song or user—while methods act as verbs for working with them. This lets an API reuse HTTP rather than inventing a separate web protocol. section 11.1.1 section 11.5

REST commonly maps CRUD actions to HTTP methods like this:

These mappings are conventions, not rules enforced by REST. POST, PUT, and PATCH can be used differently by an API, so a client needs to know both the supported methods and the payload format before making requests. JSON and XML are common payload formats. section 11.1.1 section 11.5

Updating a resource

Suppose an API exposes a resource at a URL. A PUT request supplies the resource’s complete set of fields for an update, whereas a PATCH request supplies only fields that changed. The URL identifies what is being updated; the method signals the intended operation. section 11.1.1 section 11.5

Figure 11.2 GET, POST, PUT, PATCH, and DELETE: HTTP methods for CRUD actions
figure

Compare GET, POST, PUT, PATCH, and DELETE against the CRUD actions they conventionally express. section 11.1.1

How Django in Action covers it

How deep it goes
Defines common CRUD mappings and distinguishes complete PUT updates from partial PATCH updates, while noting REST does not enforce them.
Examples
Contrasts GET, POST, PUT, PATCH, and DELETE in a CRUD reference figure.
What it assumes
Introduces HTTP as the protocol used by browsers and web servers before applying it to REST APIs.
What you can do after
Apply it via a REST API by selecting its documented method and payload format for a request.
How it connects
Connects HTTP methods with REST, CRUD, URLs, API payloads, JSON, XML, and Django Ninja endpoints.

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 Django in Action. The section links point to the parts of the book it draws on.