question

Upvotes
Accepted

how to use API for downloading data generated by schedules created by GUI.

Hi All,

we looking for one example of downloading data which is available by schedules created by GUI.

what endpoint and parameters we need to use for GUI created schedules to download.

Basically we want to use api only for downloading part. Please help.

dss-rest-apidatascope-selectdsstick-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

Hi,

I tried below endpoint but I am getting error.

Endpoint:

https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ScheduleGetByName('EC_GMT_TIC')

Error:

syntax error near unexpected token `('

What could be the reason. I used endpoint as per documents.

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.

The ScheduleGetByName can be used with the following endpoint:

GET https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ScheduleGetByName(ScheduleName='<Schedule Name>')

Could you please try? If the issue still persist, please share the perl code you are using?

Upvote
13.7k 27 8 12

@satish.shioshankar.gaidhane, this can be done in several steps:

1) Retrieve the Report Extraction ID(s)

You can use the following method to find the schedule IDs and report extraction IDs for recently completed extractions:

Send a GET request to this endpoint:

https://hosted.datascopeapi.reuters.com/restapi/v1/Extractions/ReportExtractionGetCompleted()

Results extract:

{
    "@odata.context": "https://hosted.datascopeapi.reuters.com/restapi/v1/$metadata#ReportExtractions",
    "value": [        {
            "ReportExtractionId": "2000000001094891",
            "ScheduleId": "0x05c876cdb03b2fd6",
            "Status": "Completed",
            "DetailedStatus": "Done",
            "ExtractionDateUtc": "2017-07-05T15:24:11.106Z",
            "ScheduleName": "Test2_ElektronTS_EoD_ISN",
            "IsTriggered": false
        },
        {
            "ReportExtractionId": "264698982",
            "ScheduleId": "0x05c876beb0bb2fd6",
            "Status": "Completed",
            "DetailedStatus": "Done",
            "ExtractionDateUtc": "2017-07-05T15:23:09.676Z",
            "ScheduleName": "Test_TandC_ISN",
            "IsTriggered": false,
            "ExtractionStartUtc": "2017-07-05T15:23:10.000Z",
            "ExtractionEndUtc": "2017-07-05T15:23:11.000Z"
        },...

If required you can search for specific schedules in the results, by ID or name.

Save the ReportExtractionId for the schedules of interest.

From here on, it is similar to the REST API Tutorial 10, starting from this step. In a nutshell, you first retrieve the extraction report, then the files:

2) Retrieve the Extraction Report(s)

For each schedule of interest, send a GET request to this endpoint (note that we pass the ReportExtractionId (retrieved in the previous step) as a parameter, directly in the URL):

https://hosted.datascopeapi.reuters.com/restapi/v1/Extractions/ReportExtractions('2000000001094891')/Files

Typical results:

{
    "@odata.context": "https://hosted.datascopeapi.reuters.com/RestApi/v1/$metadata#ExtractedFiles",
    "value": [
        {
            "ExtractedFileId": "VjF8fDMwMzUzMDIwOQ",
            "ReportExtractionId": "2000000001094891",
            "FileType": "RicMaintenanceNote",
            "ExtractedFileName": "Test2_ElektronTS_EoD_ISN.ric.csv",
            "LastWriteTimeUtc": "2017-07-05T15:24:23.338Z",
            "ContentsExists": true,
            "Size": 90,
            "ReceivedDateUtc": "2017-07-05T15:24:23.338Z"
        },
        {
            "ExtractedFileId": "VjF8fDMwMzUzMDIwOA",
            "ReportExtractionId": "2000000001094891",
            "FileType": "Full",
            "ExtractedFileName": "Test2_ElektronTS_EoD_ISN.csv",
            "LastWriteTimeUtc": "2017-07-05T15:24:23.333Z",
            "ContentsExists": true,
            "Size": 143,
            "ReceivedDateUtc": "2017-07-05T15:24:23.333Z"
        },
        {
            "ExtractedFileId": "VjF8fDMwMzUzMDIwNw",
            "ReportExtractionId": "2000000001094891",
            "FileType": "Note",
            "ExtractedFileName": "Test2_ElektronTS_EoD_ISN.csv.notes.txt",
            "LastWriteTimeUtc": "2017-07-05T15:24:23.340Z",
            "ContentsExists": true,
            "Size": 2064,
            "ReceivedDateUtc": "2017-07-05T15:24:23.340Z"
        }
    ]
}

Save the ExtractedFileId for the files of interest.

3) Retrieve the Extraction Report(s)

Retrieve each file of interest, by sending a GET request to this endpoint (note that we pass the ReportExtractionId (retrieved in the previous step) as a parameter, directly in the URL):

https://hosted.datascopeapi.reuters.com/restapi/v1/Extractions/ExtractedFiles('VjF8fDMwMzUzMDIwOA')/$value

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.

Please note that there are other ways to do this, see the REST API User Guide pages 111 and following (note this guide if for TRTH, not DSS, but what is described in this section applies to DSS and TRTH).

Upvotes

Thank you. Anyone working on this type of requests using perl. any examples code.?

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

thanks..working fine

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

one question, if we change schedule name using GUI, does it change schedule id as well?

or once we create schedule first time, id remains same until we delete that schedule?

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.

@satish.shioshankar.gaidhane, changing the name will not change the ID.

Upvotes

Also, one more doubt. I tried below end point. but its not downloading file instead print information about metadata.

https://hosted.datascopeapi.reuters.com/restapi/v1/Extractions/ExtractedFiles('VjF8fDMwMzUzMDIwOA')/$value

O/P like similar.:

{"@odata.context":"https://hosted.datascopeapi.reuters.com/restapi/v1/$metadata#ExtractedFiles/$entity",
"ExtractedFileId":"VjFwNWNhNdfgdfDdiNzEyZWIzMDI2fA",
"ReportExtractionId":"2000000002",
"ScheduleId":"0x05c90c3bgfdfdgd3096",
"FileType":"Full",
"ExtractedFileName":"MarketData_20170711.csv.gz",
"LastWriteTimeUtc":"2017-07-11T06:49:04.000Z",
"ContentsExists":true,
"Size":11921802}

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.

@satish.shioshankar.gaidhane, this is normal, there could be several files. There is an additional step to retrieve the files, using the ExtractedFileId, with a GET to:

https://hosted.datascopeapi.reuters.com/restapi/v1/Extractions/ExtractedFiles('ExtractedFileId')/$value

File type indicates what the file is: Full is the data file, Note is the extraction notes.

More details in REST API Tutorial 10. This particular step is explained here.

Edit: no, this is not normal. GET https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ReportExtractions('214446154')/Files should deliver that O/P.

@satish.shioshankar.gaidhane, I am not able to reproduce what you mention. I see what is described in REST API Tutorial 10:

GET https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ReportExtractions('<reportExtractionId>')/Files delivers the list of files.

GET https://hosted.datascopeapi.reuters.com/restapi/v1/Extractions/ExtractedFiles('<ExtractedFileId>')/$value delivers the data.

If you still have this issue, could you please tell us the exact list of steps you followed till you observed this issue ?

Yes. I followed above steps.. using report extractioid I get ExtractedFieldId. and using extracted fielded, I tried to get file.. but we getting almost same o/p in both steps. Only difference is in step1 we get o/p for 2 files (notes and actual file) and in step2 we get o/p for the file for which I selected extractedfieldid.

step1:

"https://hosted.datascopeapi.reuters.com/RestApi/v1/Extractions/ReportExtractions('200000009442')/Files"

step2 :

"https://hosted.datascopeapi.reuters.com/restapi/v1/Extractions/ExtractedFiles('VjF8MHgwNWNhNDdiNzEIzMDI2fA')/$value"

could you please try as well.

Show more comments
Upvotes

Hi. I used ExtractedFileId and I am getting above mentioned o/p

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.

That is strange, a GET to https://hosted.datascopeapi.reuters.com/restapi/v1/Extractions/ExtractedFiles('VjFwNWNhNdfgdfDdiNzEyZWIzMDI2fA')/$value should retrieve the file. Let me double check.

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.