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 /

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

Overview |  Quickstart |  Documentation |  Downloads

avatar image
Question by ziad.abourizk · Mar 31, 2019 at 10:38 AM · world-checkworld-check-oneunicode

Bytes to be written to the stream exceed the Content-Length bytes size specified.

Hi,

I am getting this error while passing Unicode string, For example when I am screening a name

ÖMER HİRFANOĞLU

I am getting error

"Bytes to be written to the stream exceed the Content-Length bytes size specified."

How I can send this text so that it can screen without any error.

Currently I am using UTF8Encoding

UTF8Encoding encoding = new UTF8Encoding();
byte[] byte1 = encoding.GetBytes(postData);


Here is my code

string postData = "{\"entityType\":\"" + entityType + "\",\"groupId\":\"" + groupId + "\",\"providerTypes\":[\"WATCHLIST\"],\"name\":\"" + screenText + "\"}";
string msg = postData;
var contentLength = msg.Length; UTF8Encoding encoding = new UTF8Encoding();
byte[] byte1 = encoding.GetBytes(postData);

// Assemble the POST request - NOTE every character including spaces have to be EXACT
// for the API server to decode the authorization signature
string dataToSign = "(request-target): post " + gatewayurl + "cases/screeningRequest\n" +
"host: " + gatewayhost + "\n" + // no https only the host name
"date: " + date + "\n" + // GMT date as a string
"content-type: " + "application/json" + "\n" +
"content-length: " + contentLength + "\n" +
msg;

string authorisation = "Signature keyId=\"" + apikey + "\",algorithm=\"hmac-sha256\",headers=\"(request-target) host date content-type content-length\",signature=\"" + hmac + "\"";

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.

4 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by Prabhjyot · Apr 02, 2019 at 01:53 AM

hmy-documentscode-v12cwc1postrequestcs.txt@ziad.abourizk,

Thank you for the information.

From the above provided information, it seems that you are using the variable 'byte1' for holding the UTF-8 encoded value. However, you are not calculating the length of this encoded value, which might be the reason for calculation of incorrect contentLength. Can you please try calculating the content length of the UTF-8 converted postData and see the outcome?

contentLength = byte1.length;

I am attaching code example (c#) file to this reply for your reference.

Hope this helps.


hmy-documentscode-v12cwc1postrequestcs.txt (6.1 KiB)
Comment
Mehran.Ahmed Khan
ziad.abourizk

People who like this

2 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 Prabhjyot · Apr 01, 2019 at 07:35 AM

@ziad.abourizk,

Thank you for the query.

Can you please confirm us the content length which is being calculated for the request body which you are sending in the POST request?

Also, can you please let us know the programing lanaguage which you are using?

Comment
ziad.abourizk

People who like this

1 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 ziad.abourizk · Apr 01, 2019 at 10:08 AM

Hi,

I am using C#.Net.

{"entityType":"ORGANISATION","groupId":"xxx","providerTypes":["WATCHLIST"],"name":"ERMAKSAN GEMİ VE TEKNE YAN SANAYI"}

contentLength : 151

DatatoSign:

(request-target): post /v1/cases/screeningRequest
host: rms-world-check-one-api.thomsonreuters.com
date: Mon, 01 Apr 2019 14:06:05 GMT
content-type: application/json
content-length: 151
{"entityType":"ORGANISATION","groupId":"xxx","providerTypes":["WATCHLIST"],"name":"ERMAKSAN GEMİ VE TEKNE YAN SANAYI"}

authorization:

Signature keyId="xxx",algorithm="hmac-sha256",headers="(request-target) host date content-type content-length",signature="a9BEW7NOlLWs7hpUV26EswbVUjHt/pjo57/Qfkz8Tbw="

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 ziad.abourizk · Apr 03, 2019 at 06:09 AM

Thank you very much. It works.

Comment
Prabhjyot

People who like this

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

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 >
9 People are following this question.

Related Questions

"cases/{ {case-system-id}}/screeningRequest" is not updating case results when called again after case update request

ISO Country List

Case Response Template case mismatch problem

I have tried to create some 60000 cases last night, but all failed with 404. If I try to call Monitor -ongoing screening through Postman, I get the same error 404

SEQ-5b: Get screening results. Not having Primary Name

  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • FX Venues
    • FX Trading – RFQ Maker
  • Intelligent Tagging
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open Calais
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • RDMS
  • 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
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • Workspace SDK
    • Element Framework
    • Grid
  • World-Check Data File
  • Yield Book Analytics
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges