How to get ExtractedFileId for Scheduled Completed Extractions.

How do we get the ExtractedFileId values?
I am trying this code, but it does not seem to return any value that I can use to download?
var ExtractionsContext = newExtractionsContext(newUri("https://hosted.datascopeapi.reuters.com/RestApi/v1/"), "USERNAME", “PASSWORD");
var
completedExtractions = ExtractionsContext.ReportExtractionOperations.GetCompletedByDateRange(
DateTime.UtcNow.Date.AddDays(-5),
DateTime.UtcNow.AddMinutes(5));
Best Answer
-
The download links you provided is for Web GUI only. To programmatically download the extracted file via .Net SDK, you need to call ExtractedFileOperations.GetReadStream() on the extracted file object retrieved by the code I provided in the previous answer. The extracted file normally is downloaded as data stream, so application needs to write the stream to file.
Below is the sample code modified to download an extracted data file of the first completed Report Extraction in the list returned from GetCompletedDateRange.
var completedExtractions = ExtractionsContext.ReportExtractionOperations.GetCompletedByDateRange(
DateTime.UtcNow.Date.AddDays(-5), DateTime.UtcNow.AddMinutes(5));
var extraction = completedExtractions.FirstOrDefault(e => e.Status == ThomsonReuters.Dss.Api.Extractions.ReportExtractions.ReportExtractionStatus.Completed);
if (extraction != null)
{
System.Console.WriteLine("Report Extraction Id: {0}", extraction.ReportExtractionId);
ExtractionsContext.LoadProperty(extraction, "Files");
//Find the extract file. Other ExtractedFileTypes are: Note, RicMaintenanceNote, Full, Partial, Other
var extractFile = extraction.Files.FirstOrDefault(f => f.FileType == ThomsonReuters.Dss.Api.Extractions.ReportExtractions.ExtractedFileType.Full);
if (extractFile != null)
{
//Output the contents of the extracted file
var streamResponse = ExtractionsContext.ExtractedFileOperations.GetReadStream(extractFile);
string path = "./" + extractFile.ExtractedFileName;
//Disable automatic decompression
ExtractionsContext.Options.AutomaticDecompression = false;
//Save stream to file
using (Stream s = File.Create(path))
{
streamResponse.Stream.CopyTo(s);
}
}
}Please note that the ReadStream will automatically decode data if the extracted file is in gzip format. You can add "ExtractionsContext.Options.AutomaticDecompression = false" to directly write the file without decoding.
For more detail, please see the "Retrieving the extracted files" section in this tutorial and the Streaming section in DSS Key Mechanism.
0
Answers
-
The GetCompletedByDateRange() will return the Collection of ReportExtraction. Each report extraction contains ReportExtractionId. You can access the ExtractedFileId via the "Files" property.
Below is the sample code.
var completedExtractions = ExtractionsContext.ReportExtractionOperations.GetCompletedByDateRange(
DateTime.UtcNow.Date.AddDays(-5), DateTime.UtcNow.AddMinutes(5));
foreach (var extraction in completedExtractions)
{
System.Console.WriteLine("Report Extraction Id: {0}", extraction.ReportExtractionId);
ExtractionsContext.LoadProperty(extraction, "Files");
foreach (var file in extraction.Files)
{
System.Console.WriteLine("Extracted File Name: {0}", file.ExtractedFileName);
System.Console.WriteLine("Extracted File Id: {0}", file.ExtractedFileId);
}
}0 -
Thank you for this reply. It is much appreciated. I think that I must not be asking for the correct field. Your reply gave me the ExtractedFIleID, but that must not be the field we are looking for. We are looking for a way to download our completed extractions.
All of our “COMPLETED EXTRACTIONS” on https://hosted.datascope.reuters.com/datascope/extractions/summary/
Have a download link that uses “ExtractedFile:<%Some FILE
ID%>”The download links under Completed Extractions (the scheduled ones) all seem to have this pattern:
How do we programmatically get that Extracted file
identifier?Once I have that Identifier I can easily download our completed extractions.
Or is there another way to download the Completed Extractions?
0 -
This code snippet will allow me to download the files as needed. Much appreciated. Thank you!
0 -
Request add this as a sample in the DSS Tutorial/ or create a sample in Postman collection
0 -
REST Tutorial 12 shows the entire workflow around a scheduled extraction, including checking its status and retrieving the files. All the related calls are already available in the existing Postman collection, under the Downloads tab.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 690 Datastream
- 1.4K DSS
- 629 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 559 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 280 Open PermID
- 45 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 717 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 95 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛