Equivalent Java Code for the C# code[Download Package Deliveries]
Hi,
I am able to extract the list of Package Delivery Id in JAVA but cannot find any API for downloading the files. In the REST API Reference tree Section, I found the following C# code for downloading the files. Can someone provide the download the package deliveries code in JAVA for a given PackageDeliveryId ?
var StandardExtractionsContext = new StandardExtractionsContext(new Uri("https://hosted.datascopeapi.reuters.com/RestApi/v1/"), "<your user id>", "<your password>");
//Returns the list of all available subscriptions.
var subscriptions = StandardExtractionsContext.SubscriptionOperations.GetAll();
//Output
var fromDate = DateTime.UtcNow.AddDays(-1);
var toDate = DateTime.UtcNow.AddDays(1);
foreach (var subscription in subscriptions.Take(1)) {
//Returns the list of package deliveries for which this user has permissions for a specific subscription and a range of dates.
var userPackageDeliveries = StandardExtractionsContext.UserPackageDeliveryOperations.GetUserPackageDeliveriesByDateRange(subscription.SubscriptionId, fromDate, toDate);
//Output
foreach (var userPackageDelivery in userPackageDeliveries) {
Debug.WriteLine("{0} ({1} bytes)", userPackageDelivery.Name, userPackageDelivery.FileSizeBytes);
using (var response = StandardExtractionsContext.UserPackageDeliveryOperations.GetReadStream(userPackageDelivery.PackageDeliveryId)) {
using (var fileStream = File.Create("..\\" + userPackageDelivery.Name))
response.Stream.CopyToAsync(fileStream).Wait();
}
}
}
Best Answer
-
The code you pasted comes from the C# example application, from the Standard extractions section, sample Get my Package Deliveries by Date Range . I therefore conclude you are trying to download VBD (Venue By Day) files from TRTH, and will answer on that basis (if I am wrong, please correct me).
That particular sample lists the packages (i.e. files), but does not download them. If you run the next sample, Download My Package Deliveries, it shows in step 2 how to get the package delivery IDs, and in step 3 how to download the files using the IDs. You can see the HTTP code by clicking on HTTP on screen:
The HTTP call to get a package is a GET to an endpoint, using a URL that includes the desired package ID:
https://hosted.datascopeapi.reuters.com/RestApi/v1/StandardExtractions/UserPackageDeliveryGetUserPackageDeliveriesByPackageId(PackageId='0x04f21a8d13459cb1')
Our TRTH Java sample set does not contain code that demonstrates standard extractions.
There is a C# tutorial that explains the entire process all the way to the file downloads, but as that uses the SDK you cannot recreate that directly in Java, so it is of limited use to you, except for the explanations which might be of help.
But the TRTH REST API Tutorial 2 describes all the HTTP requests required to achieve what you want (the calls are also available in a downloadable Postman collection). Creating the same calls in Java is fairly easy, the Programming without SDK tutorial explains this, and gives hints and tips.
I hope this helps.
0
Answers
-
Hello @singh5,
For multiple examples of Java code to retrieve package deliveries see:
Java Code Examples in Datascope REST API Downloads.
These examples show the steps that constitute the Datascope REST workflow, request and receive the authentication token, submit the specific request with the valid token , wait for the completion of the request and receive the valid result. Several request types are shown for completeness.
0 -
Hi @zoya faberov,
Thanks for replying. I cannot find any API for Downloading the Package Delivery File in the DSS Documentation for the given FileId. Can you help with providing the Http Get/Post Request API for the same?
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
- 687 Datastream
- 1.4K DSS
- 621 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 4 Trading API
- 2.9K Elektron
- 1.4K EMA
- 254 ETA
- 557 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 276 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 669 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
- 104 UPA
- 193 TREP Infrastructure
- 229 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛