HTTP 400 half the time when using accents in name

Options

Hi,


When calling the ScreeningRequest API with a name containing accents, I'm having one time in two HTTP 400.

I'm doing the following when sending my request:

  1. The content body is converted to UTF-8.
  2. We calculate the length of the UTF-8 encoded content since UTF-8 payload length is different than the normal payload body.
  3. We're using the normal payload/content body in the dataToSign variable.
  4. Then we use the content length of the UTF-8 encoded in the dataToSign variable.
  5. Next, we're sending the UTF-8 encoded content/payload in the API request.
  6. At last, we send the content length of the UTF-8 encoded in the request header.

For instance with "Stéphane Bern", I'm having a result the first time, then the second time, I'm having an HTTP 400.

Here what I'm sending:

==> POST https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/cases/screeningRequest HTTP/1.1
- entity [Content-Type: application/json; charset=UTF-8,Content-Length: 185,Chunked: false]
- body : {"groupId":"ZZZ","entityType":"INDIVIDUAL","providerTypes":["WATCHLIST"],"name":"Stéphane Bern","secondaryFields":[{"typeId":"SFCT_1","value":"MALE"}]}
- headerGroup (request) : [Date: Thu, 23 Jan 2020 14:21:57 GMT, Authorization: Signature keyId="XXX",algorithm="hmac-sha256",headers="(request-target) host date content-type content-length",signature="YYY", Content-Type: application/json]
- The answer : HttpResponseProxy{HTTP/1.1 400  [Transfer-Encoding: chunked, Date: Thu, 23 Jan 2020 14:12:22 GMT, X-Cnection: close, Server: ""] ResponseEntityProxy{[Chunked: true]}}


When the return is HTTP 200 :

==> POST https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/cases/screeningRequest HTTP/1.1
- entity [Content-Type: application/json; charset=UTF-8,Content-Length: 185,Chunked: false]
- body : {"groupId":"ZZZ","entityType":"INDIVIDUAL","providerTypes":["WATCHLIST"],"name":"Stéphane Bern","secondaryFields":[{"typeId":"SFCT_1","value":"MALE"}]}
- headerGroup (request) : [Date: Thu, 23 Jan 2020 14:21:20 GMT, Authorization: Signature keyId="XXX",algorithm="hmac-sha256",headers="(request-target) host date content-type content-length",signature="YYY", Content-Type: application/json]
- The answer : HttpResponseProxy{HTTP/1.1 200  [Cache-Control: no-cache, no-store, max-age=0, must-revalidate, Pragma: no-cache, Expires: 0, X-XSS-Protection: 1; mode=block, X-Frame-Options: DENY, X-Content-Type-Options: nosniff, Date: Thu, 23 Jan 2020 14:13:57 GMT, Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked, Server: ""] ResponseEntityProxy{[Content-Type: application/json;charset=UTF-8,Chunked: true]}}

Is there something I am missing?

Best Answer

  • Irfan.Khan
    Irfan.Khan LSEG
    Answer ✓

    @cao-trung.do

    The dev team have responded that the issue has been resolved. I have tested this and found all my screening requests with non english characters to be successful.

    Please re test and let us know if the issue persists.

Answers

  • @cao-trung.do

    50 percent of the screening requests containing non English characters are failing with 400: Bad request. This has been already identified as an issue and currently worked on by our development team to resolve it.


  • Hello,


    Could you tell us if this problem is solved?


    I have the same problem as Cao-Trung. If I use accents in the name or surname, I always get a 400 error.


    I use the follow String to calculate the length in the signature and in the API request.

    {"groupId":"XXX","entityType":"INDIVIDUAL","providerTypes":["WATCHLIST"],"name":"Marlène Schiappa","secondaryFields":[]}

    You can find an attached picture of my implementation (accent error.JPG).


    Thank you very much,

  • Hi @eric.simeoni,

    Thanks for reaching out to us! I was wondering if you could provide the sequence of API calls being sent along with request/response headers (please make sure to blur/delete API key/secret) that you are using? I just want to make sure nothing is being missed!

    Thanks,

    Judith

  • Hello,


    This weekend, we find a solution.


    For others, in our Java application, we juste added :

    Normalizer.normalize(value, Normalizer.Form.NFD);

    To normalize the lastname and firstname.


    Thank you,

  • @eric.simeoni That's great! Please reach out again via email or through a question in the forum if you need further assistance.

    Thanks,

    Judith

  • There is a simple way to fix this, you can change

    payload.length()

    to

    payload.getBytes().length

    on generateAuthHeaders implementation.

    The content-length will be correct after this.