A minimal API maps a route to a handler, often a lambda: app.MapGet("/products/{id:int}", (int id, IProductStore store) => ...). ASP.NET Core fills the handler's parameters for you: a parameter named like a route value ({id}) gets it, simple types not in the route come from the query string (?page=2), registered services come from dependency injection, and a complex type in a POST comes from the JSON body. A route constraint such as {id:int} makes /products/abc match no route at all.
The handler returns data (sent as JSON with status 200) or an IResult that sets the status: Results.Ok(product), Results.NotFound(), Results.Created($"/products/{id}", product) with a Location header, Results.Conflict(), Results.BadRequest() and Results.ValidationProblem(errors) for a 400 with field-by-field messages. Getting the status right is part of the API contract: clients branch on it.
Input is validated before it is used. Data annotations such as [Required] and [Range] (from System.ComponentModel.DataAnnotations) describe the rules, and Validator.TryValidateObject checks them.
About the code here: ASP.NET Core does not run in this browser runtime, so these exercises use a small stand-in for the ASP.NET Core host, with the same names and the same rules for what this lesson checks. It is a simplification: there is no HTTP server or middleware. app.SendAsync(method, url, body) plays the part of a client, JSON uses the same camelCase names, and [FromBody]-style attributes are not needed or supported. The data annotations are the real ones.
A GET with a route value and a POST with a JSON body, each returning a specific status.