As described in the Web API Documentation :
By default, the Web API uses the following rules to bind parameters:
- "" , Web API URI. .NET(int, bool, double ..), TimeSpan, DateTime, Guid, decimal, string, , . ( .)
- Web API -.
[FromBody] , [FromBody] , , , . catch-sample , , JSON.
, 2 :
JSON
POST /api/person HTTP/1.1
Host: localhost:5000
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 747a5d76-398c-e1c7-b948-b276bb24976c
"b85f75d8-e6f1-405d-90f4-530af8e060d5"
- :
public class Request
{
public Guid Id { get; set; }
}
[Route("api/person")]
[HttpPost]
public async Task<IActionResult> Person([FromBody] Request request) { ... }