In order to test my I was testing my webApi post method, I need to send model object as parameter. I was sending it as raw data but it was giving error
“{“Message”:”The request entity’s media type ‘text/plain’ is not supported for this resource.”,”ExceptionMessage”:”No MediaTypeFormatter is available to read an object of type ” from content with media type ‘text/plain’…..
My raw data was in below format
{
“Id”: 1,
“Email”: “test@test.com”,
“UserID”: 19530,
“ContactId”: null,
“TnC”: true,
“TnCAcceptanceDate”: “0001-01-01T00:00:00”,
“Prefix”: null,
“Country”: null,
“PostalCode”: null
}
After some research I found my mistake. In the HTTP request you need to set Content-Type to: Content-Type: application/json
Content type in my Post request was selected as “text/plain” which should be application/json. After changing it to “application/json”, it worked for me.