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

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    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.

Answers