Hi all!
Please tell me how to add the request body to the invoke code.
Request body to add looks like this:
{
"object extract":
{
"extractType": "Ownership",
"objects":
[
{
"cadastralNumber": "11:22:1232456:12"
}
]
}
}
My invoke code:
var client = new RestClient("*");
client.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
var request = new RestRequest(Method.POST);
client.Timeout = 10000;
request.AddHeader("Authorization", "ReestroAuth apiKey=*&portal.orgid=*");
request.AddHeader("Content-Type", "application/json");
request.AddJsonBody(new
{
extractType = "Ownership",
objects =
[
{
cadastralNumber = "11:22:1232456:12"
}
]
}
);
IRestResponse response = client.Execute(request);
json_content = response.Content; // {"message":"created."}
if ((int)response.StatusCode == 0)
{
Console.WriteLine("Code 0");
}
else{
Console.WriteLine("another answer");
Console.WriteLine(json_content);
}