question

Upvotes
Accepted
1 0 0 1

How can I update ReportTemplate QueryStartDate ?

I would like to update QueryStartDate of ReportTemplate in TickHistoryTimeAndSalesExtractionRequest. I used PUT request to update this condition and sent request by python. But it did not work as I expected. QueryStartDate didn't change.

Is it possible to update this kind of condition using by API?

tick-history-rest-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
11.3k 25 8 13

@hikaru.isobe

Do you mean that you would like to update the condition in the existing report template?

If so, you can update the QueryStartDate condition of a report template using REST API via HTTP PUT. Below are the instructions.

1. Get information of the report template.

Attribute of the report template cannot be partially updated, so you need to get all information of the report template first via HTTP GET.

GET https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/TickHistoryTimeAndSalesReportTemplates('<report template id>') 

or

GET https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ReportTemplateGetByName(Name='<report template name>')

You will get the report template information as below.

{
    "@odata.context": "https://hosted.datascopeapi.reuters.com/RestApi/v1/$metadata#TickHistoryTimeAndSalesReportTemplates/$entity",
    "ReportTemplateId": "0x05f0e7c6253b2f76",
   ...
    "Condition": {
        ...
        "ReportDateRangeType": "Range",
        "QueryStartDate": "2016-11-11T06:05:00.000Z",
        "QueryEndDate": "2018-10-01T06:05:00.000Z",
        "DateRangeTimeZone": "UTC",
        ...
    }
}

2. Modify QueryStartDate condition in the payload received from the first step, and then send HTTP PUT request with the modified payload to update the report template. You will get a response with 204 No Content if the update is success.

PUT https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/TickHistoryTimeAndSalesReportTemplates('<report template id>')
{
    "@odata.context": "https://hosted.datascopeapi.reuters.com/RestApi/v1/$metadata#TickHistoryTimeAndSalesReportTemplates/$entity",
    "ReportTemplateId": "0x05f0e7c6253b2f76",
   ...
    "Condition": {
        ...
        "ReportDateRangeType": "Range",
        "QueryStartDate": "2018-10-01T06:05:00.000Z",
        "QueryEndDate": "2018-10-02T06:05:00.000Z",
        "DateRangeTimeZone": "UTC",
        ...
    }
}
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