For a deeper look into our DataScope Select REST API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvote
Accepted
20 6 6 8

DSS - Extracted files - Clean up

Is there any api or a way to remove 'Extracted files' with additional information(ScheduleId, ReportExtractionId... )? What our team wants to do is remove specific file on 'Extracted files' PROGRMATICALLY.

In document below, I just found about 'Clean up' section, but there is no about 'Extracted files'. (Only about instrument list, a report template and a schedule)

- https://developers.thomsonreuters.com/datascope-select-dss/datascope-select-rest-api/learning?content=5994&type=learning_material_item

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

· Write an Answer
Upvote
Accepted
462 13 11 15

Hi,

I would recommend using the .NET Example Application (C# / Direct HTTP - executable code examples):

https://hosted.datascopeapi.reuters.com/RestApi.Help/Home/ExampleAppInstructions

(from landing page: https://hosted.datascopeapi.reuters.com/RestApi.Help/Home/Index - DSS credentials required)

Once unzipped use ...\RESTAPIExampleApplication\bin\Release\Dss.Api.Examples.exe

Login into DSS App using DSS credentials

The "Schedule Extractions" (section) > "Cleanup" example should help here, particularly this part of the code:

//Delete the extracted files, schedule, instrument list and report template. See the "Cleanup" example for
//the various steps involved with cleanup. NOTE: It is a good idea to clean up the extracted files (Report Extractions)
//once you have downloaded the results. If the schedule is not immediate (i.e. recurring), you want to keep the 
//instrument list, report template and schedule around.
if (schedule.ScheduleId != null)
{
 //Get the extractions so that we can delete the extraction files
 var scheduleExtractions = ExtractionsContext.ReportExtractionOperations.GetByScheduleId(schedule.ScheduleId);
foreach (var reportExtraction in scheduleExtractions) { //Get all the files for this extraction ExtractionsContext.LoadProperty(reportExtraction, "Files");
//Use the DeleteMultiple method to delete all the files associated with the schedule var fileIds = reportExtraction.Files .Where(f => f.ContentsExists).Select(f => f.ExtractedFileId).ToList(); if (fileIds.Count > 0) ExtractionsContext.ExtractedFileOperations.DeleteMultiple(fileIds); }

This landing page can also be found via the DSS GUI: https://hosted.datascope.reuters.com/DataScope/ > "Help" (dropdown) > "REST API Help"

Best regards,

Gareth

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.