SEQ-4a Post Screen a case get Error 400 Bad Request

Hi, Try to implement Screen a case like sample SEQ-4a. Post request get Error 400 Bad Request.
I use the postman default group id in the pilot environment.
Please check the source code as below, for the function of “Save a simple case”
// -----------------------
procedure TForm2.btSaveasimplecaseClick(Sender: TObject);
var
response : string;
RequestBody : TstringStream;
tt : TBytes;
dataToSign, strdatetime : string;
thedate : tdatetime;
const
strbody='{ "entityType": "INDIVIDUAL", "groupId":"418f28a7-b9c9-4ae4-8530-819c61b1ca6c","providerTypes": ["WATCHLIST"], "name": "John Doe"}';
strbaseurl='https://rms-world-check-one-api-pilot.thomsonreuters.com/v1/cases';
begin
thedate:=now-(13/24); // get server time , the offset of the time different is 13 hours
strdatetime:= formatdatetime('ddd, dd mmm yyyy hh:mm:ss "GMT"',thedate);
edtdate.Text:=strdatetime; // display purpose – date string
dataToSign:= '(request-target): post /v1/cases'+#10 +'host: rms-world-check-one-api-pilot.thomsonreuters.com' +#10+'date: '+strdatetime+#10+'content-type: application/json'+#10+'content-length: '+
inttostr(length(strbody))+#10+strbody;
msignstring.Lines.Text:=datatosign; // Sign string -- display purpose
tt:=System.Hash.THashSHA2.GetHMACasBytes(dataToSign,APIsecret,SHA256);
edtsignatures.text:=EncodeBase64(tt,length(tt)); // signature string - display purpose
edtauth.Text:='Signature keyId="a4364e62-e58b-4b64-9c71-faead5417557",algorithm="hmac-sha256",headers="(request-target) host date content-type content-length",signature="'+edtsignatures.text+'"'; // authorization string
edit1.Text:=inttostr(length(strbody)); // content -length
RequestBody := TStringStream.Create(strbody, TEncoding.UTF8);
RequestBody.Position := 0;
try
IdHTTP1.Request.CustomHeaders.Clear;
IdHTTP1.Request.Method:=Id_HTTPMethodPost;
IdHTTP1.Request.ContentType := 'application/json';
IdHTTP1.Request.CustomHeaders.AddValue('cache-control', 'no-cache');
IdHTTP1.Request.CustomHeaders.AddValue('authorization',edtauth.Text);
IdHTTP1.Request.CustomHeaders.AddValue('date', strdatetime);
IdHTTP1.Request.CustomHeaders.AddValue('content-type', 'application/json');
IdHTTP1.Request.CustomHeaders.AddValue('content-length', inttostr(length(strbody)));
try
IdHTTP1.Post(strbaseurl, RequestBody);
except
on e:EIdHTTPProtocolException do
begin
showmessage(e.ErrorMessage+' .. '+ e.Message );
end;
on e:exception do
showmessage(e.Message);
end;
memo1.Lines.text:=IdHTTP1.ResponseText;
finally
RequestBody.Free;
end;
end;
// --------------------- end of code ---------------
Sign string:
(request-target): post /v1/cases
host: rms-world-check-one-api-pilot.thomsonreuters.com
date: Mon, 09 Jan 2017 23:38:56 GMT
content-type: application/json
content-length: 130
{ "entityType": "INDIVIDUAL", "groupId":"418f28a7-b9c9-4ae4-8530-819c61b1ca6c","providerTypes": ["WATCHLIST"], "name": "John Doe"}
Signature:
QldTAT5loM20vBrFMBZg1ErrnYnrVtPcx+ZpxQKjkqo=
Authorization:
Signature keyId="a4364e62-e58b-4b64-9c71-faead5417557",algorithm="hmac-sha256",headers="(request-target) host date content-type content-length",signature="QldTAT5loM20vBrFMBZg1ErrnYnrVtPcx+ZpxQKjkqo="
Date:
Sun, 08 Jan 2017 21:52:47 GMT
Content Length:
130
Response:
HTTP/1.1 400 Bad Request
Any ideal? Please help.
Thanks.
John
Best Answer
-
Hi, i have found the problem and got this issue resolved. Basically it is the the HTTP component bug does not stream string parameters in order. Also there is another reasons cause the body string not compatible with the REST server. Thanks a lot for the help. John
0
Answers
-
Hi @information
We do not support IDE environments. However If your GET requests succeed, then the body of your POST request is not formed properly. Perhaps try not encoding the string, first.
Brian
ddfdii,
0 -
Thanks Brian for the reply. I will try this.
0 -
Consider watching:
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 690 Datastream
- 1.4K DSS
- 629 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 559 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 24 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 279 Open PermID
- 45 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 713 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 95 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛