Reputation: 1742
I'm looking at somebody else webapp written in asp.net and it has a post request handler with this prototype
public class NotificationsController : ApiController
{
public async Task<HttpResponseMessage> Post(string pns, [FromBody]string message, string to_tag)
.....
.....
I'm testing that post request handler with postman (Chrome extension) and providing pns and to_tag as url parameters. But how do I provide message parameter? I tried setting content-type as json and provide message in body as
{ "message" : "hello"} OR { "body" : "hello" }
But I'm getting 500 error code.
Upvotes: 1
Views: 65
Reputation: 11105
It kind of depends on what version of Postman you are using. But you will put your JSON in the Body tab and choose the 'raw' radio button also on the Body tab.
You will want to set the Content-Type
header to application/json
. If you are still having issues, please add an image to your question of the Postman screen.
You will want to use: { "message" : "hello"}
for the body message.
Finally, the pns
and to_tag
parameters should probably also be given [FromUri]
annotations so it is more clear that they are to be passed in as URL Parameters.
Upvotes: 1