For a deeper look into our World Check One API, look into:

Overview |  Quickstart |  Documentation |  Downloads

question

Upvotes
Accepted
5 0 0 2

Unauthorized error encountered when using cases/"+ caseId + "?aggregatedSummary=true in httpClient

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?




#productc#screening-apiworldcheck-one-apicase
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted

Hi @mahesh.s ,

Thanks for reaching out to us!

After reviewing the above provided C# code sample, could you please update your code by omitting the query parameter("?aggregatedSummary=true") from the "signUrl" string and then pass the value in the "dataToSign" string as below.

string signUrl = "cases/" + caseSystemId;

string dataToSign = "(request-target): get " + gatewayurl + signUrl + "\n" +


Please feel free to reach out to us if you still face any issue after making the above changes in your code.


Thanks

Sai.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

The code above was successful. Thank you.

Upvotes
1.1k 2 2 3

Hello @mahesh.s - thank you for reaching out to us!

Let me gather some more information regarding your inquiry and I will get back to you as soon as I have more information. Thank you for your patience.

Best,

Judith

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.