2
Asp.net web api that serves [Frombody] and [Fromuri] and when there is real need to use ?
example:
public IHttpActionResult Get([FromUri] email)
{
}
public IHttpActionResult Get([FromBody] email)
{
}
2
Asp.net web api that serves [Frombody] and [Fromuri] and when there is real need to use ?
example:
public IHttpActionResult Get([FromUri] email)
{
}
public IHttpActionResult Get([FromBody] email)
{
}
2
There are two attributes for you to make explicit which will be the parameter Binding that your API will use. By default, the framework will map almost all objects as a JSON that comes in the request body (Datetime, Guid, are examples of objects that it will try to pick up from the URI), and all simple/primitive types as a value that will come in the request URI. So, if you want to do the reverse, you need to specify where the request is coming from.
Example, if you want to receive a string that comes in the body of your request, you must specify for the API: public IHttpActionResult GetPessoaPorNome([FromBody] string pessoa) {}
Browser other questions tagged c# asp.net-mvc asp.net-web-api
You are not signed in. Login or sign up in order to post.