Good day,
I created a REST Service (POST) with string parameter (Body) - working fine.
When I change the parameter to an Entity Record, it fails with error: 400 Bad Request - Failed to parse JSON request content.
The service is called from a .NET window service using JSON .Net and RESTSharp
var restClient = new RestClient(Properties.Settings.Default.WebHookEndPoint);
restClient.Authenticator = new HttpBasicAuthenticator("Username", "pwd");
var request = new RestRequest(Method.POST);
request.Resource = "/Create_My_Transaction";
request.RequestFormat = DataFormat.Json;
request.AddJsonBody(message);
var response = restClient.Execute(request);
The content of the message parameter is as follows (same name, order and data types as the attributes):
{"Param1":800,"Param2":800," Param3":"ZAR"," Param4":"MQ Test Transaction"," Param5":"555**555","Param6":"2016-03-13T10:35:47.3865167+02:00","Param7":"2016-03-13T10:35:47.3865167+02:00","Param8":123.7}
The class:
public class DummyData
{
public int Param1 { get; set; }
public int Param2 { get; set; }
public string Param3 { get; set; }
public string Param4 { get; set; }
public string Param5 { get; set; }
public DateTime Param6 { get; set; }
public DateTime Param7 { get; set; }
public Double Param8 { get; set; }
}
Any assistance will be appreciated!
Thank you!