question

Upvotes
Accepted
1 2 2 6

TRTHv2 REST API

screenshot-from-rest-api-user-guide-45-46.pdf

Case : 05603568

Hi Team,

Client is unable to run a tick data query using the new REST API . Getting an error when trying to replicate page 46 of the REST API user manual.

------------------------------------------------------------

POST https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ExtractRaw

Authorization: Token

Content-Type: application/json

Prefer: respond-async
{"ExtractionRequest": {"Condition": {"ReportDateRangeType": "Range", "MessageTimeStampIn": "GmtUtc", "ApplyCorrectionsAndCancellations": true, "ExtractBy": "Entity", "QueryEndDate": "2017-06-15T00:00:00.000Z", "DisplaySourceRIC": true, "Preview": "Content", "QueryStartDate": "2017-06-16T00:00:00.000Z"}, "IdentifierList": {"UseUserPreferencesForValidationOptions": false, "ValidationOptions": null, "@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifierList", "InstrumentIdentifiers": [{"Identifier": "CCU7", "IdentifierType": "Ric"}]}, "@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.TickHistoryTimeAndSalesExtractionRequest", "ContentFieldNames": ["THT.Quote - Ask Price", "THT.Quote - Ask Size", "THT.Quote - Bid Size", "THT.Quote - Bid Size"]}}

{'error': {'message': 'Malformed request payload: For the property name "ReportDateRangeType" in the JSON request the value could not be parsed successfully. Please check the casing or spelling of the property.'}}

'{"error":{"message":"Malformed request payload: Syntax error at Line 1, Char 71: Invalid array element type for property \'ContentFieldNames\'. Expected element type of \'ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.ExtractionRequestBase\', but found \'System.String\'. {\\"ExtractionRequest\\": {\\"ContentFieldNames\\": [\\"Auction - Exchange Tim"}}'

It looks like the JSON parser is not correctly converting datatypes.

------------------------------------------------------------

tick-history-rest-apirest-api
icon clock
10 |1500

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

1 Answer

Upvotes
Accepted
13.7k 26 8 12

@Romita.Dastidar

There are several issues in that request:

  • The extraction request data type must be the first element of the content.
  • The identifier list should not be inside the conditions
  • Content field names should use the Name, not the Code, i.e. they should use "Quote - Bid Size", not "THT.Quote - Bid Size"
  • There is a duplicate field name.
  • The query start date is after the end date.

This one will work:

{
  "ExtractionRequest": {
    "@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.TickHistoryTimeAndSalesExtractionRequest",
    "ContentFieldNames": [
      "Quote - Ask Price", "Quote - Ask Size", "Quote - Bid Price", "Quote - Bid Size"
    ],
    "IdentifierList": {
      "@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",  
      "InstrumentIdentifiers": [{
        "Identifier": "CCU7",
        "IdentifierType": "Ric"
      }],
      "ValidationOptions": null,
      "UseUserPreferencesForValidationOptions": false
    },
    "Condition": {
      "MessageTimeStampIn": "GmtUtc",
      "ApplyCorrectionsAndCancellations": true,
      "ReportDateRangeType": "Range",
      "QueryStartDate": "2017-06-15T00:00:00.000Z",
      "QueryEndDate": "2017-06-16T00:00:00.000Z",
      "ExtractBy": "Entity",
      "Preview": "Content",
      "DisplaySourceRIC": true
    }
  }
}
icon clock
10 |1500

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

Click below to post an Idea Post Idea