Let's say my controller is taking an object parameter without [FromBody], how do I post the data using Postman? I tried this way but it doesn't reach the endpoint.
You can use raw body data to send anything you can enter as text. Use the raw tab, and the type dropdown list to indicate the format of your data (Text, JavaScript, JSON, HTML, or XML) and Postman will enable syntax-highlighting as well as appending the relevant headers to your request.
I think in this case, since you're not using [fromBody] your object should be in the URL and not in the Request Body.
in Postman, this can be done using the Query Params
as the screenshot shows.
Yet, I don't think you could pass an object in the query params like that. I think you should instead turn it into a query string like this format
"User=abc&Pass=abc"
Multiple ways to achieve this can be found here
If your controller is taking an object parameter without [FromBody] then you must send the data as URL parameter:
POST http://localhost:44364/login?object={"User":"abc","Pass":"abc"}
Note: replace "object" by the name of the parameter in your controller. Also you have to know that Postman should converts special characters { " : , to %XX format and you have to manage that in your service.
If you want to send it in the body, then include [FromBody]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With