Error sending json in POST to web API service
another tip...where to add "content-type: application/json"...to the textbox field on the Composer/Parsed tab. There are 3 lines already filled in there, so I added this Content-type as the 4th line. That made the Post work.
In the HTTP request you need to set Content-Type to: Content-Type: application/json
So if you're using fiddler client add Content-Type: application/json
to the request header
- You have to must add header property
Content-Type:application/json
When you define any POST request method input parameter that should be annotated as
[FromBody]
, e.g.:[HttpPost] public HttpResponseMessage Post([FromBody]ActivityResult ar) { return new HttpResponseMessage(HttpStatusCode.OK); }
Any JSON input data must be raw data.