Do we need always three HTTP requests to download a file after the initial request ?
I am working on TRTH REST - API - C++ - On demand extraction
All is working fine :
I sent a request
=> I get an extraction ID (sth like '0x05d8855d69cb3036')
=> I then get a reportID (sth like '2000000001865568')
=> I then get an extractedFileID (sth like 'VjF8MHgwNWQ4ODU2YzU0MmIzMDI2fA')
However, in this third request I notice in the body of the reply a field extractedFileName = '_OnD_0x05d8855d69cb3036.csv.gz'. I was wondering whether it could be possible to download directly the result file with this file name information since it is easy to build this string from the extractionID obtained by the initial request.
I am aware I should anyway wait for a status 'Completed' (status = 200) of the request before trying a download.
Best regards
Best Answer
-
For On Demand extraction, after getting the ExtractionId and the status is completed (200), the response will contain the JobId which is the same value as ExtractionId.
GET https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractRawResult(ExtractionId='0x05d865a51a7b2f96')
RESPONSE
STATUS 200 OK
{
"@odata.context": "https://hosted.datascopeapi.reuters.com/RestApi/v1/$metadata#RawExtractionResults/$entity",
"JobId": "0x05d865a51a7b2f96",
"Notes": [
"Extraction Services Version 11.1.37192 (54656a7aa87e), Built Aug 9 2017 15:35:02\nUser ID: 9008895\nExtraction ID: 2000000001853403\nSchedule: 0x05d865a51a7b2f96 (ID = 0x0000000000000000)\nInput List (1 items): (ID = 0x05d865a51a7b2f96) Created: 08/24/2017 10:27:50 Last Modified: 08/24/2017 10:27:50\nReport Template (120 fields): _OnD_0x05d865a51a7b2f96 (ID = 0x05d865a52d0b2f96) Created: 08/24/2017 10:27:05 Last Modified: 08/24/2017 10:27:05\nSchedule dispatched via message queue (0x05d865a51a7b2f96), Data source identifier (4955E8FEB448405D94AC1747B054C192)\nSchedule Time: 08/24/2017 10:27:07\nProcessing started at 08/24/2017 10:27:07\nProcessing completed successfully at 08/24/2017 10:27:51\nExtraction finished at 08/24/2017 03:27:51 UTC, with servers: tm04n01\nInstrument <RIC,CARR.PA> expanded to 1 RIC: CARR.PA.\nQuota Message: INFO: Tick History Cash Quota Count Before Extraction: 1910; Instruments Extracted: 0; Tick History Cash Quota Count After Extraction: 1910, 382% of Limit; Tick History Cash Quota Limit: 500\nQuota Message: WARNING: Tick History Cash Quota has been reached or exceeded\nManifest: #RIC,Domain,Start,End,Status,Count\nManifest: CARR.PA,Market Price,2017-07-18T04:16:42.143815611Z,2017-07-18T11:59:49.652317454Z,Active,71068\n"
]
}Then, you can use HTTP GET with /Extractions/RawExtractionResults('0x05d865a51a7b2f96')/$value to get the file.
0
Answers
-
Hello !
/Extractions/RawExtractionResults('0x05d865a51a7b2f96')/$value allows to display the data in a browser (it they are not too big) but does it allow to save a file myFile.csv.gz ?
It is perfect to check data in Postman but to download a file, is it the good way ?
If so, could you please elaborate with an example ?
Regards
0 -
Refer to REST API Reference Tree, Extractions/RawExtractionResults({id})/$value returns the native/raw contents of the extraction. The content is in .csv.gz format.
When it is in gz format, most applications typically decompress the retrieved data and then display it as CSV.
You can verify it by using curl to down the file from RawExtractionResults('0x05d983da410b3016')/$value.
curl -k -X GET -H "Authorization: Token <token>" -o outfile.csv.gz https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/RawExtractionResults('0x05d983da410b3016')/$value
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛