question

Upvotes
Accepted
5 4 5 11

HTTP 400 half the time when using accents in name

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?

world-checkworld-check-one
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.

Upvotes
Accepted
4.2k 8 5 6

@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.

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.

Upvotes
4.2k 8 5 6

@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.


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.

Upvotes
1 0 0 0

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,


accent-error.jpg (88.8 KiB)
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.

Upvotes
1.2k 2 2 3

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

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.

Upvotes
1 0 0 0

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,

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.

@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

Upvotes
1 0 0 0

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.

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.