API V3 - Unable to query requests

API V3 - Unable to query requests

Hi, we're trying to get all requests based on certain criteria via the V3 API web services. I can successfully query it using PostMan but not C#. PostMan allows to export code for various languages, including RestSharp which uses C# and .NET. I've also tried other methods like cURL which works fine also. The code is below. If we omit the input_data it works okay (but brings back everything). And the error indicates that. Any help would be appreciated.

Thanks

Daniel

{"response_status":{"status_code":4000,"messages":[{"status_code":4001,"field":"input_data","type":"failed","message":"Unable to parse the JSON"}],"status":"failed"}}

  1. var client = new RestClient("http://sdserver:8080/api/v3/requests");
  2. client.Timeout = -1;
  3. var request = new RestRequest(Method.GET);
  4. request.AddHeader("TECHNICIAN_KEY", "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
  5. request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
  6. request.AddParameter("input_data", "{\"list_info\":{\"search_criteria\":[field:created_time,values:[\"1568777400000\",\"1568795400000\"],logical_operator:between]}}");
  7. IRestResponse response = client.Execute(request);
  8. Console.WriteLine(response.Content);

                  New to ADSelfService Plus?