RESTful API

Hi All,

I am  calling 3rd party RESTful Api. I am calling Uri link with Headers having Bearer token and Prefer : respond-async as Get method. The request return 202 status and link. I use the link provided in the header for the next Get call as Uri and send it with Bearer token, the return value I get is

ProcessingStatusCode:{codevalue:started}

but not the actual value.

The code below:

The is the async call with link to the Api

Task<HttpResponseMessage> callbulkTask = Task.Run(async () => await client.SendAsync(bulkrequest));

callbulkTask.Wait(retryafter);

HttpResponseMessage bulkresponse = callbulkTask.Result;

int i = 1;

do

{

Task<string> bulkcontent = Task.Run(() => bulkresponse.Content.ReadAsStringAsync());

bulkcontent.Wait();

Console.WriteLine($“BulkResult:{bulkcontent.Result}”);

Thread.Sleep(1000);

i++;

}

while (retry > i);

I need the actual output. Please let me know what is the issue going on with this code.

Note: Output is above.