liveBook · Manning

Request message

As explained in The Design of Web APIs, Second Edition

POST is the HTTP method for submitting data to a resource for processing, commonly resulting in resource creation or another state change.

HTTP POST submits data to a resource for processing. It most commonly creates a new resource, but it can also represent actions such as adding, starting, saving, or sending when another method does not fit. section 4.3.1

Creating a catalog product

Use POST /products to add a product and let the system generate its reference. The returned reference can then identify the product through GET /products/{Product reference}. This is usually preferable to PUT when identifiers are random, because consumer-provided IDs can collide. section 4.3.5

Map common collection and resource operations as follows:

  • Create an element: POST /elements. section 4.3.6
  • Add or create a customer: POST /customers; prefer meaningful paths over action paths such as /add-customer. section 9.3.1
  • Treat POST as non-idempotent: replaying POST /transfers can create multiple transfers and repeatedly change server state. section 12.5.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 CRUD-to-HTTP mapping when choosing POST, GET, PUT, PATCH, or DELETE for an operation. section 4.3.1

How The Design of Web APIs, Second Edition covers it

How deep it goes
Explains semantics, endpoint choices, identifier trade-offs, and replay risks while deferring deeper implementation behavior and resource-ID decisions.
Examples
Uses product creation, customer creation, collection mappings, and repeated money-transfer requests as concrete examples.
What it assumes
Assumes HTTP resources, paths, clients, servers, and request-response interactions, while connecting those basics to REST operations.
What you can do after
Apply it via HTTP by designing creation endpoints, selecting between POST and PUT, and assessing replay consequences.
How it connects
Connects POST with REST APIs, CRUD, resource paths, HTTP methods, PUT, PATCH, GET, DELETE, and idempotency.

Also explained in

Compare how 14 books explain request message →

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.