Hi team,
I have a requirement to fetch case details by case ID. Initially, I successfully received a response using cases/{caseId} via C# httpClient. However, I also require the aggregated summary. According to the documentation and Postman collection, I attempted to pass cases/"+ caseId + "?aggregatedSummary=true, but encountered an Unauthorized error.
Here is the code I've been using.
DateTime dateValue = DateTime.UtcNow;
string date = dateValue.ToString("R");
string gatewayurl = "/v2/";
string gatewayhost = "api-worldcheck.refinitiv.com";
string apikey = "api-key";
string apisecret = "secret-key";
string requestendpoint = "https://api-worldcheck.refinitiv.com/v2/cases/"+ caseId + "?aggregatedSummary=true";
string signUrl = "cases/" + caseId + "?aggregatedSummary=true";
string dataToSign = "(request-target): get " + gatewayurl + signUrl + "\n" +
"host: " + gatewayhost + "\n" +
"date: " + date;
string hmac = generateAuthHeader(dataToSign, apisecret);
string authorisation = "Signature keyId=\"" + apikey + "\",algorithm=\"hmac-sha256\",headers=\"(request-target) host date\",signature=\"" + hmac + "\"";
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri(requestendpoint),
Headers =
{
{ "Authorization",authorisation },
{ "Date", date },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
Console.WriteLine(response.StatusCode);
}
Can you help me find a solution?