liveBook · Manning

Request message

As explained in ASP.NET Core in Action, 3e

POST is an HTTP method used to send data to a server for processing or resource creation.

A request message carries a client’s request to an HTTP server. Its verb indicates the intended operation: GET retrieves data, while POST sends data for server processing, such as completing a form. In an ASP.NET Core minimal API, endpoints respond to requests by matching the verb and URL path. section 3.6 section 5.2.2

Use request messages with these practical distinctions:

  • Use GET to fetch data without changing server state; use POST to send data or create a new resource. section 5.2.2
  • Map a POST request to a minimal API endpoint with MapPost(); clients such as single-page applications and mobile apps can send verbs that browsers do not usually issue by navigation. section 5.2.2
  • Access the complete incoming request through HttpRequest, including request-specific details; inject the exact type needed when that makes the handler clearer. section 7.6.1
  • Let minimal API binding obtain values from explicit sources, route values, query strings, services, or a JSON request body; a failed required binding produces a 400 response. section 7.8

Form submission to an API

A form submission can send a POST request containing data to an endpoint. The application maps that request with MapPost(), then processes the submitted data instead of treating the request as a page navigation. section 3.6 section 5.2.2

Table 5.1 The minimal API map endpoints and the corresponding HTML verbs (view table figure)

Method

HTTP verb

Expected operation

MapGet(path, handler)

GET

Fetch data only; no modification of state. May be safe to cache.

MapPost(path, handler)

POST

Create a new resource.

MapPut(path, handler)

PUT

Create or replace an existing resource.

MapDelete(path, handler)

DELETE

Delete the given resource.

MapPatch(path, handler)

PATCH

Modify the given resource.

MapMethods(path, methods, handler)

Multiple verbs

Multiple operations.

Map(path, handler)

All verbs

Multiple operations.

MapFallback(handler)

All verbs

Useful for SPA fallback routes.

Compare the minimal API mapping methods with their HTTP verbs and expected operations, including POST for creating a resource. section 5.2.2

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains verbs, endpoint mapping, request access, and binding order, but stops short of detailing HTTP wire-format fields.
Examples
Uses form submission, MapPost endpoints, HttpRequest parameters, and a minimal API verb-operation table.
What it assumes
Assumes basic HTTP request awareness while teaching verbs, URL paths, endpoint mapping, and minimal API binding behavior.
What you can do after
Apply it via ASP.NET Core minimal APIs by choosing POST appropriately, mapping an endpoint, and binding incoming values.
How it connects
Connects HTTP verbs with minimal APIs, endpoint routing, model binding, JSON request bodies, and HttpRequest.

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 ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.