So if I would want to get say a User data, passing user id, I will use GET
verb and pass user id in query string with route something like this
[HttpGet]
[Route("user/{userId}")]
But what if I want to fetch user based on multiple input parameters. Say by UserType, Salary etc.
Then passing these multiple values or complex object values in querystring will not make sense, I will have to pass them in body and for that I will have to use the POST
verb.
But is it correct to use POST
verb to get data?
If not, which verb should I use for these cases
Not sure why nobody suggested me to use FromBody
attribute with my parameter.
That way I do not have to change the api to POST
.
I can use GET
and still pass the parameter in the body.