World check Api: problem with QUERY PARAMETERS
With c# in every Api with query parameters i have error 401.
Example:
this works:
RequestUri = new Uri("https://api-worldcheck.refinitiv.com/v2/cases/5jb6uu6extle1hugpq6ibcm37),
error 401:
RequestUri = new Uri("https://api-worldcheck.refinitiv.com/v2/cases/5jb6uu6extle1hugpq6ibcm37?aggregatedSummary=true"),
Best Answer
-
Hi @raffaele.rocco, I have emailed you a working request sample with the query parameters "?aggregatesSummary=true". Kindly take a look at it at your earliest convenience.
A couple things to note:- With the attached sample code, we can confirm that the provided case system id has returned an aggregated summary of the case against the API key and API secret
- To confirm a successful API response with the end point "?aggregatedSummary=true", we advise to wrap the end point as a URI instead of sending it as a string. The attached sample code does contain such code line
- The sample code contains your API credentials included the case system id. Please import the sample code as a project with your IDE. The project name is api.sln
- The sample code contains an Authorization builder to takes care of generating the hmac. The authorization builder is contained in the code file name AuthHeaderBuilder.cs. This is part of the project.
Kindly let me know the outcome at your earliest convenience.
Blessings,
Judith
0
Answers
-
Complete code from your example:
DateTime dateValue = DateTime.UtcNow;
string date = dateValue.ToString("R");
string gatewayurl = "/v2/";
string gatewayhost = "api-worldcheck.refinitiv.com";
string apikey = "xxxxxxxxxxxxxxxxxxxx";
// "caseId": "5jb6uu6extle1hugpq6ibcm36",
string apisecret = "xxxxxxxxxxxxxxxxxx";
string nameApi = "cases/5jb6uu6extle1hugpq6ibcm37";
//error 401
//string nameApi = "cases/5jb6uu6extle1hugpq6ibcm37?aggregatesSummary=true";
string requestendpoint = "https://api-worldcheck.refinitiv.com/v2/" + nameApi;
string dataToSign = "(request-target): get " + gatewayurl + nameApi + "\n" +
"host: " + gatewayhost + "\n" + // no https only the host name
"date: " + date; // GMT date as a string
// The Request and API secret are now combined and encrypted
string hmac = generateAuthHeader(dataToSign, apisecret);
string authorisation = "Signature keyId=\"" + apikey + "\",algorithm=\"hmac-sha256\",headers=\"(request-target) host date\",signature=\"" + hmac + "\"";
Console.WriteLine(authorisation);
// Send the Request to the API server
HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(requestendpoint);
// Set the Headers
WebReq.Method = "GET";
WebReq.Headers.Add("Authorization", authorisation);
WebReq.Headers.Add("Cache-Control", "no-cache");
WebReq.Date = dateValue; // use datetime value GMT time
// Get the Response - Status OK
HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
// Status information about the request
Console.WriteLine(WebResp.StatusCode);
Console.WriteLine(WebResp.ResponseUri);
// Get the Response data
Stream Answer = WebResp.GetResponseStream();
StreamReader _Answer = new StreamReader(Answer);
string jsontxt = _Answer.ReadToEnd();
// convert json text to a pretty printout
var obj = Newtonsoft.Json.JsonConvert.DeserializeObject(jsontxt);
var f = Newtonsoft.Json.JsonConvert.SerializeObject(obj, Newtonsoft.Json.Formatting.Indented);
Console.WriteLine(f);
0 -
Hello @raffaele.rocco - thank you for reaching out. I will be looking into your question shortly and will respond to you as soon as I have an update. Thanks!
Blessings,
Judith
0 -
Ok thank's.
If it can help you, i have error only when i use this format to the url:
?param=xxxx
instead it works in this format:
/param
0 -
Hi @raffaele.rocco - thank you for your patience. Our World-Check One API Dev Community Downloads section has Request Code Samples, and I am attaching our updated C# .NET samples below: postRequest.txt & getRequest.txt
Kindly let me know if these request samples are able to help you get a successful response at your earliest convenience.
Blessings,
Judith
0 -
Understood, thanks for the specification!0
-
Sorry Judith, but your example is the same one i used and it works.
I have the error 401 only when i use query parameters!
Example:
string requestendpoint = "https://api-worldcheck.refinitiv.com/v2/cases/5jb6uu6extle1hugpq6ibcm37?aggregatesSummary=true"
0 -
with your c# example now it works.
Thank you
0 -
It works. Thank's
0 -
That's great! Thanks for the update.
Blessings,
Judith
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛