I try to call the endpoint https://api-worldcheck.refinitiv.com/v2/cases/saveAndScreen in C# with a name which is "RATP Réseaux" but I am returned a 401 but when I change the name to " RATP Reseaux" I have a 200. I think it's because of the "é" character but he encodes it in UTF8.
here is my function which allows you to call api
public async Task<T?> PostRequest<T>(Uri uri, string data) { using (HttpClient client = _clientFactory.CreateClient()) { HttpMethod httpMethod = HttpMethod.Post; Encoding encoding = Encoding.UTF8; string contentType = "application/json"; HttpRequestMessage httpRequest = new HttpRequestMessage(httpMethod, uri); Dictionary<string, string> headers = AuthHeadersBuilder.GenerateAuthHeaders( apiKey, apiSecret, httpMethod.Method.ToLower(), uri, contentType, data); foreach (KeyValuePair<string, string> header in headers) { httpRequest.Headers.Add(header.Key, header.Value); } httpRequest.Content = new StringContent(data, encoding, contentType); httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse(contentType); var response = client.SendAsync(httpRequest).Result; response.EnsureSuccessStatusCode(); var jsonContent = await response.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject<T?>(jsonContent); } }
and my body is :
{ "groupId": "5jb6eq4nmdc41ihi4jaus2r156", "providerTypes": [ "WATCHLIST" ], "nameTransposition": true, "caseScreeningState": { "WATCHLIST": "INITIAL" }, "cases": [ { "entityType": "ORGANISATION", "name": "SNCF Réseau", "secondaryFields": [ { "typeId": "SFCT_192", "value": "FRA" }, { "typeId": "SFCT_6", "value": "FRA" }, { "typeId": "SFCT_193", "value": "FR-RCS" }, { "typeId": "SFCT_191", "value": "412280737" } ] } ] }
Do you have a solution ?
THANKS,
PRAK Billy