question

Upvotes
Accepted
5 0 1 3

Using API to download Extractions on Tick History

Hello,

Once the instrument list, report template and schedule has been set up using GUI, would it be possible to use REST API just to download the Extracted Files on Tick History?

If so, is there a documentation about this step? Also, where do I get the job id when sending a request?


Thank you!

dsstick-history-rest-api
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.

Upvotes
Accepted
86.2k 292 53 78

@Kat

I assumed that you already have a schedule created on the DSS server. For example:

1630636512201.png

To use the REST API to get the extracted data of the schedule, you need to know the schedule ID of that schedule. You can use the following endpoint with the HTTP GET method to get the schedule ID from the schedule name.

Extractions/ScheduleGetByName(ScheduleName='DailySchedule') 

The output will contain the schedule ID in the "ScheduleId" field.

{
    "@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#Schedules/$entity",
    "ScheduleId": "0x07b1b9370a7d1892",
    "Name": "DailySchedule",
    "OutputFileName": "DailyOutput",
    "TimeZone": "GMT Standard Time",
    "Recurrence": {
...
}

Then, we can use the ScheduleId with the following endpoint and the HTTP GET method to get the completed report extractions.

Extractions/ReportExtractionGetCompletedByScheduleId(ScheduleId='0x07b1b9370a7d1892')
Or
Extractions/Schedules('0x07b1b9370a7d1892')/LastExtraction

The output will contain the "ReportExtractionId" field.

{
    "@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#ReportExtractions/$entity",
    "ReportExtractionId": "542712727",
    "ScheduleId": "0x07b1b9370a7d1892",
    "Status": "Completed",
    "DetailedStatus": "Done",
    "ExtractionDateUtc": "2021-09-03T02:34:09.026Z",
    "ScheduleName": "DailySchedule",
    "IsTriggered": false,
    "ExtractionStartUtc": "2021-09-03T02:34:10.000Z",
    "ExtractionEndUtc": "2021-09-03T02:34:13.000Z"
}

Next, we can use the "ReportExtractionId" to get a list of files in that report by using the following endpoint with the HTTP GET method.

Extractions/ReportExtractions('542712727')/Files

The output will contain a list of files.

"value": [
        {
            "ExtractedFileId": "VjF8fDg4MTM0NTI2MA",
            "ReportExtractionId": "542712727",
            "ScheduleId": "0x07b1b9370a7d1892",
            "FileType": "RicMaintenanceNote",
            "ExtractedFileName": "DailyOutput.ric.csv",
            "LastWriteTimeUtc": "2021-09-03T02:34:13.068Z",
            "ContentsExists": true,
            "Size": 90,
            "ReceivedDateUtc": "2021-09-03T02:34:13.068Z"
        },
        {
            "ExtractedFileId": "VjF8fDg4MTM0NTI0OA",
            "ReportExtractionId": "542712727",
            "ScheduleId": "0x07b1b9370a7d1892",
            "FileType": "Full",
            "ExtractedFileName": "DailyOutput.csv",
            "LastWriteTimeUtc": "2021-09-03T02:34:12.947Z",
            "ContentsExists": true,
            "Size": 708,
            "ReceivedDateUtc": "2021-09-03T02:34:12.947Z"
        },
        {
            "ExtractedFileId": "VjF8fDg4MTM0NTI0Nw",
            "ReportExtractionId": "542712727",
            "ScheduleId": "0x07b1b9370a7d1892",
            "FileType": "Note",
            "ExtractedFileName": "DailyOutput.csv.notes.txt",
            "LastWriteTimeUtc": "2021-09-03T02:34:13.071Z",
            "ContentsExists": true,
            "Size": 1634,
            "ReceivedDateUtc": "2021-09-03T02:34:13.071Z"
        }
    ]

Typically, each report has three file types (Note, Full, and RicMaintenanceNote). The extracted data is available in the Full file type.

Finally, you need to use the ExtractedFileId field to get the file by using the following endpoint with the HTTP GET method.

Extractions/ExtractedFiles('VjF8fDg4MTM0NTI0OA')/$value

In summary, there are four steps to use the REST API to retrieve the data extracted from the schedule.

1. Get the ScheduleId from the schedule name

2. Get the completed report extractions (ReportExtractionId) from the ScheduleId

3. Get the list of files (ExtractedFileId) in the report extraction

4. Get the file from the ExtractedFileId


1630636512201.png (33.5 KiB)
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.

Upvotes
5 0 1 3

Thank you! This is helpful.

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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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