Read timed out - End of Day price data

Requirements: We want End of Day price from DSS
Technology : Salesforce
DSS REST API Service : https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractWithNotes
Issue : System.CalloutException: Read timed out
Expected API: Instead of timeout can you send us ExtractionID and Data "Example: ExtractionId='0x053b21c6eadb5821'" as a response body. we will retrieve data from DSS REST AOU "ExtractResult(ExtractionId='0x053b21c6eadb5821'
Sample code
request.setTimeout(120000); //Maximum in milliseconds
request.setMethod('POST');
request.setHeader('Content-Type', 'application/json');
request.setHeader('Prefer','respond-async');
request.setHeader('Authorization',userAuthResponseSessionToken);
HttpResponse response = http.send(request); //Getting Timeout from DSS
system.debug('Status Code is '+response.getStatusCode()); //Exception thorwn above line, hence don't get status code here as 202 Accepted or 200 etc
String resultBody = response.getBody();
System.debug(Logginglevel.DEBUG,response.getBody());
Best Answer
-
Answer by Veerapath, copied here to be able to close the thread:
The error indicates that the value in the Authorization header is incorrect. The Authorization header needs to start with "Token" string. Please modify the code as follows.
request.setHeader('Authorization','Token'+ usrAuthResponseSession);
0
Answers
-
@abhishek.tripathi, could you please:
- Post the full body of your POST request ? (This can be done as an attachment if it is large)
- Tell us if the timeout happens systematically or only occasionally ?
That would help us debug the issue you are facing.
0 -
As requested, Please find detail source code for post request and debug response message for more analysis for your side.
This timeout is getting always I did not get a success response from DSS for given API.
looking forward your response asap.
try{
system.debug('Invoke ExtractWithNotes END Point');
String endPointURL = 'https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractWithNotes';
Httprequest request = new HttpRequest();
Http http = new Http();
request.setTimeout(120000); //Maximum
request.setMethod('POST');
request.setHeader('Content-Type', 'application/json');
//request.setHeader('Content-Type', 'application/json; odata=minimalmetadata; charset=utf-8');
//request.setHeader('Content-Length', '40960');
request.setHeader('Prefer','respond-async'); //[{"key":"Prefer","value":"respond-async","enabled":true}]
request.setHeader('Authorization',usrAuthResponseSession);
request.setEndpoint(endPointURL);
HttpResponse response = http.send(request);
system.debug('Status Code is '+response.getStatusCode());String resultBody = response.getBody();
System.debug(Logginglevel.DEBUG,response.getBody());
system.debug('responseBody: '+response.getBody());
//Logic to Parse JSON response received from reuters DSS API
//
system.debug('Begin Json Parser.............');
}catch(Exception e){
system.debug(' Exception thorwn ExtractWithNotes at line no '+e.getLineNumber()+' with message as '+e.getMessage());
}Debug Logs :
10:47:32.705 (1714711814)|USER_DEBUG|[33]|DEBUG|Invoke ExtractWithNotes END Point
10:47:32.705 (1714914452)|CALLOUT_REQUEST|[45]|System.HttpRequest[Endpoint=https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractWithNotes, Method=POST]
10:49:32.817 (121817001599)|EXCEPTION_THROWN|[45]|System.CalloutException: Read timed out
10:49:32.817 (121817293268)|USER_DEBUG|[55]|DEBUG| Exception thorwn ExtractWithNotes at line no 45 with message as Read timed out0 -
The ExtractWithNotes requires request's body. From the code, I cannot see the .setBody() method. Could you verify and add the body of the request?
0 -
As requested, I have added setbod with json default value provided by refinitive doc. Now error message is "
{"error":{"message":"The Authorization header is malformed. Supported Authorization types are Token,Basic."}}
try{
system.debug('Invoke ExtractWithNotes END Point');
String endPointURL = 'https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractWithNotes';
Httprequest request = new HttpRequest();
Http http = new Http();
request.setTimeout(120000); //Maximum
request.setMethod('POST');
//request.setHeader('Content-Type', 'application/json');
request.setHeader('Content-Type', 'application/json; odata=minimalmetadata; charset=utf-8');
request.setHeader('Content-Length', '40960');
request.setHeader('Prefer','respond-async'); //[{"key":"Prefer","value":"respond-async","enabled":true}]
request.setHeader('Authorization',usrAuthResponseSession);
request.setEndpoint(endPointURL);
String jsonBody = '{"ExtractionRequest":{"@odata.type":"#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.EndOfDayPricingExtractionRequest","ContentFieldNames":["Ask Price","Asset Category","Asset Category Description","Asset ID","Asset Status","Asset Status Description","Asset SubType","Asset SubType Description","Asset Type","Asset Type Description","Bid Price","Block Trades","CIN Code","Common Code","Currency Code","Currency Code Description","Currency Code Scaled","Currency Code Scaled Description","CUSIP","Exchange Code","Exchange Description","Exercise Style","Expiration Date","File Code","High Price","Instrument ID","Instrument ID Type","ISIN","Issuer OrgID","Lot Size","Low Price","Market MIC","MIC","Mid Price","Net Asset Value","Number of Price Moves","Offer Price","Official Close Price","Open Price","Previous Close Price","Put Call Indicator","Quote ID","RCP ID","RIC","Security Description","SEDOL","Settlement Date","Settlement Price","SICC","Sicovam","Strike Price","Ticker","Trade Date","Trading Status","Trading Symbol","Turnover","Underlying RIC","Universal Ask Price","Universal Bid Ask Date","Universal Bid Price","Universal Close Price","Usage Instrument SubType","Usage Instrument Type","Valoren","Volume","VWAP Price","Wertpapier"],"IdentifierList":{"@odata.type":"#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifierList","InstrumentIdentifiers":[{"Identifier":"438516AC0","IdentifierType":"Cusip"},{"Identifier":"IBM.N","IdentifierType":"Ric"}]},"Condition":null}}';
request.setBody(jsonBody);
HttpResponse response = http.send(request);
system.debug('Status Code is '+response.getStatusCode());String resultBody = response.getBody();
System.debug(Logginglevel.DEBUG,response.getBody());
system.debug('responseBody: '+response.getBody());
//Logic to Parse JSON response received from reuters DSS API
//
system.debug('Begin Json Parser.............');
}catch(Exception e){
system.debug(' Exception thorwn ExtractWithNotes at line no '+e.getLineNumber()+' with message as '+e.getMessage());
}13:15:14.361 (1369227165)|METHOD_EXIT|[29]|01p0w000000U0Ru|CLS_REUTERS_DMCC_RESTIntegration.UserAuthentication()
13:15:14.361 (1369251582)|USER_DEBUG|[30]|DEBUG| User Session is __iBBvv5hKfLUzE4RJkEunTDu8neSdGv8j-k3t53pVbb4dNGyu7oGbg78tu3tEaERYa3zxaijd7zyqzMqg7c0EwsWHl35Yo-aEQwHIzESozsS9PdXWJHIKP4QRyY0dbiD0JpNVmSMS14uav-8GF47gzdPiY1dckVuqUVTqHO3bSyNr-C72_HWpBFUJ7r0rYy8nHIHC8m3pqmQsM3XeIxh9lx5QHq_LXnJ7rw4weHqnLFwmgqs5qKBR4hHHvk2jfZBzwBPSo5FecIYy0RUx2UIICRIreDDcK1nmT3bpNN1BTM
13:15:14.361 (1369270826)|USER_DEBUG|[33]|DEBUG|Invoke ExtractWithNotes END Point
13:15:14.361 (1369498596)|CALLOUT_REQUEST|[47]|System.HttpRequest[Endpoint=https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractWithNotes, Method=POST]
13:15:14.361 (1751567992)|CALLOUT_RESPONSE|[47]|System.HttpResponse[Status=Unauthorized, StatusCode=401]
13:15:14.361 (1751715552)|USER_DEBUG|[48]|DEBUG|Status Code is 401
13:15:14.361 (1751797366)|USER_DEBUG|[51]|DEBUG|{"error":{"message":"The Authorization header is malformed. Supported Authorization types are Token,Basic."}}
13:15:14.361 (1751830263)|USER_DEBUG|[52]|DEBUG|responseBody: {"error":{"message":"The Authorization header is malformed. Supported Authorization types are Token,Basic."}}
13:15:14.361 (1751857272)|USER_DEBUG|[55]|DEBUG|Begin Json Parser.............0 -
The error indicates that the value in the Authorization header is incorrect. The Authorization header needs to start with "Token" string. Please modify the code as follows.
request.setHeader('Authorization','Token'+ usrAuthResponseSession);
0 -
It's working now. Thanks lot for your support.
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
- 25 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 280 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
- 720 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 中文论坛