question

Upvotes
Accepted
5 0 0 1

Missing 'JobId' in HTTP Response for Check request status.

I'm requesting the API according to this Doccument.

https://developers.refinitiv.com/thomson-reuters-tick-history-trth/thomson-reuters-tick-history-trth-rest-api/learning?content=11307&type=learning_material_item

But there is no JobId that should be included in the body when the status is 200. (Check request status - HTTP response)
Instead, the tick history data by the name 'Contents' was returned.
It is the same when making a request to 'Location' of 202 status header.
Why is there no JobId?
I have obtained the necessary data, but please let me know because I am interested.



url = 'https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractWithNotes'
    request_headers = {
        "Prefer": "respond-async",
        "Content-Type": "application/json",
        "Authorization": "token " + token
    }
    body = {
        "ExtractionRequest": {
            "@odata.type": "#ThomsonReuters.Dss.Api.Extractions"
                           ".ExtractionRequests."
                           "ElektronTimeseriesExtractionRequest",
            "ContentFieldNames": [
                "Trade Date", "Open", "High", "Low",
                "Last", "Ask", "Bid", "Volume"
            ],
            "IdentifierList": {
                "@odata.type": "#ThomsonReuters.Dss.Api.Extractions."
                               "ExtractionRequests.InstrumentIdentifierList",
                "InstrumentIdentifiers": instrumentIdentifiersList,
                "UseUserPreferencesForValidationOptions": "false"
            },
            "Condition": {
                "StartDate": START_DATE,
                "EndDate": END_DATE
            }
        }
    }
tick-history-rest-apiresponse
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Upvotes
Accepted
13.7k 26 8 12

@mdt,

The REST API tutorial 3 you refer to describes the workflow for ExtractRaw. But your code uses extractWithNotes. That is why you observe a different response. Let me explain ...

An On Demand extraction can be made using 2 different end points: ExtractWithNotes or ExtractRaw. The request body and header are the same, only the end point changes. But the workflows are not the same for extractWithNotes and ExtractRaw, and the end result also differs.

extractWithNotes

The response of extractWithNotes is in JSON format, it contains the data in an object called Contents, and has an additional object, Notes, containing the Extraction notes and RIC maintenance report.

As this endpoint deliver the data in JSON format, it is only appropriate for small data sets. That is not often the case with TRTH, that is why REST API tutorial 3 does not describe this endpoint, but concentrates on the extractRaw endpoint.

extractRaw

This endpoint deliver the data as a compressed CSV file, which is appropriate for all TRTH data sets.

The initial response of extractRaw is in JSON format, but does not contain the data. It contains an object called JobId (which is a string), and a Notes object, containing the Extraction notes and RIC maintenance report. The next step is to make a GET call, using the JobId, to an endpoint which contains the JobId as parameter, as described in REST API tutorial 3.

This last call must include a header stating that we want compressed data: Accept-Encoding: gzip

Note:

  • If that header is included in the GET call, the response contains the data, in CSV format, compressed using gzip.
  • If the header is not included, the response will be in CSV format, not compressed.

Conclusions

For more information, you can look at the DSS REST Tutorials introduction. Even though it is in the DSS section of the portal, not in the TRTH section, it applies to both, as DSS and TRTH use the same backend servers.

For TRTH I'd recommend always using extractRaw, that avoids having to handle 2 different workflows, and is appropriate for small and large data sets.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.