Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Screening /
  • World-Check One /
avatar image
Question by terrence.lim · Dec 10, 2019 at 07:02 AM · world check one apichinese name screening

What format should be used to request the API without an error to screen Chinese name?

These are some information you may like to know:


Error message returned: org.springframework.web.client.HttpClientErrorException: 401


request url: https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/cases/screeningRequest


httpEntity: <{"customFields":[],"entityType":"INDIVIDUAL","groupId":"0a3687d0-693a-1414-9a6d-52c700001613","name":"张三","providerTypes":["WATCHLIST"],"secondaryFields":[{"typeId":"SFCT_1","value":"MALE"},{"dateTimeValue":{"pointInTimePrecision":"DAY","timelinePrecision":"ON","utcDateTime":-485600400000},"typeId":"SFCT_2"},{"typeId":"SFCT_5","value":"HKG"}]},{Date=[5 Dec 2019 03:17:12 GMT], Authorization=[Signature keyId="4eeea3fb-d10a-4521-b083-229ed9dce00b",algorithm="hmac-sha256",headers="(request-target) host date content-type content-length",signature="Ngt2S9g3oWJ/v4vkHKCSohlzg9q1tExTkBsgf9sghHo="], Content-Length=[349], Content-Type=[application/json]}>


Response : HTTP Status Code 401

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

11 Replies

  • Sort: 
avatar image
Best Answer
Answer by terrence.lim · Dec 11, 2019 at 09:46 AM

RestTemplate to POST with UTF-8 encoding

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
Answer by Irfan.Khan · Dec 10, 2019 at 07:37 AM

@terrence.lim

This question has been answered before in this portal.

Please have a look at the link below. This will help you understand how to screen chinese characters successfully.

https://community.developers.refinitiv.com/questions/50476/401-unauthorized-when-calling-worldcheck-with-name.html?childToView=50477#answer-50477


Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
Answer by terrence.lim · Dec 10, 2019 at 09:08 AM

Tried and it is still not working.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
Answer by Irfan.Khan · Dec 10, 2019 at 09:31 AM

@terrence.lim

Request you to share the code snippets with comments so that I can see how are you sending the screening request with special characters.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
Answer by terrence.lim · Dec 10, 2019 at 10:15 AM

@Override public WdProcessParamsDto apply(WordCheckContextDto wordCheckContextDto,

WordCheckInputParamsDto wordCheckInputParamsDto) {

WdCaseAPIReqDto caseAPIReqDto = buildRequestCaseParams(wordCheckContextDto, wordCheckInputParamsDto);

//The content body

String requestJSONParams = JSON.toJSONString(caseAPIReqDto);

int length = EscapeUtils.unescape(URLEncoder.encode(requestJSONParams)).length();


//get timestamp

String currentDateOfGmtValue = new Date().toGMTString();

String dataToSign = "(request-target): post " + configurationProperties.getGatewayUrl() + "cases/screeningRequest\n" + "host: "

+ configurationProperties.getGatewayHost() + "\n" + "date: " + currentDateOfGmtValue + "\n"

+ "content-type: application/json\n" + "content-length: " + length + "\n" + requestJSONParams;

//See below

String hmac = SecretUtils.generateSha256(configurationProperties.getSecret(), dataToSign);


String authorisation = "Signature keyId=\"" + configurationProperties.getApiKey()

+ "\",algorithm=\"hmac-sha256\",headers=\"(request-target) host date content-type content-length\",signature=\""

+ hmac + "\"";


WdProcessParamsDto paramsDto = new WdProcessParamsDto();

paramsDto.setCallURL(MessageFormat.format(APIURL, configurationProperties.getProtocol(),

configurationProperties.getGatewayHost(), configurationProperties.getGatewayUrl()));


paramsDto.setHeadAuthorization(authorisation);

paramsDto.setHeadDate(currentDateOfGmtValue);


paramsDto.setExtParams(() -> {

Map<String, Object> map = new HashMap<>(2);

map.put("Content-Length", length);

map.put("Content-Data", requestJSONParams);

return map;

});


return paramsDto;

}

//SecretUtils.generateSha256

public static String generateSha256(String secret, String message) {

String hash = "";

try {

Mac sha256_HMAC = Mac.getInstance("HmacSHA256");

SecretKeySpec secret_key = new SecretKeySpec(secret.getBytes(), "HmacSHA256");

sha256_HMAC.init(secret_key);

hash = Base64.encodeBase64String(sha256_HMAC.doFinal(message.getBytes()));


} catch (Exception e) {

System.out.println("Error");

}

return hash;

}

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
Answer by Irfan.Khan · Dec 10, 2019 at 01:11 PM

@terrence.lim

I see that you are using the below code to calculate the length:

int length = EscapeUtils.unescape(URLEncoder.encode(requestJSONParams)).length(); 

You can use the below code instead of the above:

int length = EscapeUtils.unescape(URLEncoder.encode(requestJSONParams,"UTF-8")).length(); 

Also, I see that you are not passing the UTF-8 enccoded JSON payload in the API request but the content of the variable requestJSONParams. Please UTF-8 encode the payload before sending it over. Please check point 5 in my first reply.

map.put("Content-Data", requestJSONParams); 


Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
Answer by terrence.lim · Dec 10, 2019 at 01:26 PM

Tried and same error.

Also, our project's encoding is utf-8

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
Answer by terrence.lim · Dec 10, 2019 at 01:31 PM

Edited and tried the following also not resolving the issue

map.put("Content-Data", URLEncoder.encode(requestJSONParams,"UTF-8"));

and

int length = EscapeUtils.unescape(URLEncoder.encode(requestJSONParams,"UTF-8")).length();

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
Answer by Irfan.Khan · Dec 10, 2019 at 01:33 PM

@terrence.lim

Instead of the below code:

URLEncoder.encode(requestJSONParams,"UTF-8"));

Can you try the below:

HttpEntity entity= new StringEntity(requestJSONParams,Charsets.UTF-8);

Request you to provide me the complete request headers and response headers so that I can trouble shoot.

Kindly compare the Base64 encoded HMAC signature and content lenght generated by your code to that of the one generated by Postman to know if your signature is correct. You can do this by executing your code first, then pick up the date header value from your code and paste in the pre request script of Postman to generate the HMAC (obviously the request will fail as the date header value is obsolete but you should get the same HMAC signature). Compare both to know if they match.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
Answer by terrence.lim · Dec 11, 2019 at 06:36 AM

It is still not working.

Comment

People who like this

0 Show 1 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
Irfan.Khan ♦♦ · Dec 11, 2019 at 07:05 AM 0
Share

@terrence.lim

Let us get into a phone call to resolve this.

Please provide me a good time (with time zone) so that I can send you a webex invite.

avatar image
Answer by terrence.lim · Dec 11, 2019 at 09:15 AM

Hi Irfan, finally we managed to resolve the matter. Thanks again for your support.

Comment

People who like this

0 Show 1 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
Irfan.Khan ♦♦ · Dec 11, 2019 at 09:17 AM 0
Share

@terrence.lim Can you please help us with the solution so that it helps our other community members who have the same issue?

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
13 People are following this question.

Related Questions

World check one api.​How to integrate World Check one api in my application?

What happens when we provide wrong value in secondary field for screening?

World Check One API Documentation, prerequisites

Case Create/Update using WC1 API ?

How to use World check one API result

  • Feedback
  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Careers
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Calais
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRIT
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • World-Check Data File
  • Explore
  • Tags
  • Questions
  • Badges