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

Overview |  Quickstart |  Documentation |  Downloads

question

Upvotes
Accepted
3 0 0 3

POST http save Screen with special characters

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

#productworld-checkc#worldcheck-one-api
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.

1 Answer

· Write an Answer
Upvotes
Accepted
61 1 0 0

Hello,

Letters with diacritical marks encoded in utf-8 can have a length of 2.
"é".length => 2
This is likely causing your 401 error, depending on how your length calculation is made.

Try removing diacritics before any processing is done or try adjusting your length calculations to account for the diacritics.

See:

Issue with special characters in World Check One Screening - Forum | Refinitiv Developer Community


Try using our Postman collection to quickly test out requests and verify responses:

LSEG World-Check One API Guide

Included in this link is our sample code which should help you account for diacritics.


Let us know if you require any assistance with your authorization header code.


Thanks,

WC1 API Team

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.