Asynchronus calls for search contacts api are not working

Asynchronus calls for search contacts api are not working. I am using asynchronus call, below is the code snippet. After exucuting the “.PostAsync” line process is stopping. Please suggest by seeing the below code snippet is really API support the async??

var client = new RestClient(“https://api.hubapi.com”);
var request = new RestRequest(“crm/v3/objects/contacts/search”, Method.Post);
request.AddHeader(“accept”, “application/json”);
request.AddHeader(“content-type”, “application/json”);
request.AddHeader(“authorization”, $“Bearer {_token}”);
var body = JsonConvert.SerializeObject(contactSearchRequest);
request.AddParameter(“application/json”, body, ParameterType.RequestBody);
var response = await client.PostAsync(request);

Hey, @hpolice :waving_hand: That’s a good question. The documentation doesn’t call this out as possible, so I do wonder. One question for you — have you tried wrapping your code in a try-catch block to see if any exceptions are being thrown?

Thanks! — Jaycee

Hey @Jaycee_Lewis,

I have added try catch blocks, but no exeption found. It simply stoped my console application after execution of “var response = await client.PostAsync(request)” line;

PREVIEW

Are you using the nuGet package v110.2.0 for RestSharp for C#? I cannot use request.AddHeader and I

am getting frustraited. Any feedback is appreciated. Thank you.