Normally, when using a REST API, we use either POST, PUT, or sometimes even PATCH verbs to send content as payloads. This content is then translated into POCO classes, which are defined as parameters to action methods.
It turns out that ASP.NET Core can bind payloads to POCOs if you bind from the body of the request or from the query string, but you cannot exclude (or include) specific properties using the [Bind], [BindNever], and [BindRequired] attributes. A typical example is as follows:
[ApiController]
public class PetController : ControllerBase
{
[HttpPost]
public IActionResult Post([FromBody] Pet pet) { ... }
}
This is because ASP.NET Core uses input formatters to bind requests to models, and since these can change, it's up to them to decide what properties should be skipped or not—for example, a certain JSON serializer might use some attributes to configure property serialization, which would be ignored by others.
...