I am unable to bind data to the locationModel parameter in the following method. I looked at other posts but no solution seems to be working:
// Web Api Post method
public HttpResponseMessage Post(string vin, [FromBody] LocationModel locationModel)
{
return null;
}
I am invoking the method through fiddler in the following manner:
The method is called upon executing the post request but the LocationModel is null. Here is the definition for the LocationModel:
public class LocationModel
{
public string Url { get; set; }
public DateTime LogTimestamp { get; set; }
public float Latitude { get; set; }
public float Longitude { get; set; }
public decimal OdometerReading { get; set; }
public DateTime LastUpdatedTimestamp { get; set; }
public string Source { get; set; }
}
What am I doing wrong?
Your JSON is slightly malformed - you have
rather than
i.e. you have
=
instead of: