Hello,
we are using the C# SDK and we were wondering if there are any plans to introduce the ability to get TRTH results over AWS as announced in the TRTH release notes 11.1.5.5
Thanks
@Giovanni.Condello, it is possible to do that using the C# SDK.
In the code you must set the x-direct-download header, it would look somewhat like this:
var context = new StandardExtractionsContext(newUri("https://hosted.datascopeapi.reuters.com/RestApi/v1/"), "<your user id>", "<your password>");context.DefaultRequestHeaders.Add("x-direct-download", "true");var stream = context.UserPackageDeliveryOperations.GetReadStream("<packageDeliveryId>");// Read Stream here…
I have not yet tried this, but will attempt to make a sample in a near future, which I'll make available for download when available.
@Giovanni.Condello
You can also use the following code to set the X-Direct-Download header. This will set the header once for a next API call.
Func<System.Collections.Generic.Dictionary<string, string>> directDownload = delegate(){ System.Collections.Generic.Dictionary<string, string> header = new System.Collections.Generic.Dictionary<string, string>(); header.Add("X-Direct-Download", "true"); return header;};ExtractionsContext.SetRequestHeaders(directDownload);using (var response = ExtractionsContext.RawExtractionResultOperations.GetReadStream(result))
Hi Oliver!
Yes it did work in the end. Thanks all for the support
BR
Giovanni
@Giovanni.Condello, here is a tested code snippet:
//Set header for direct download from AWS:extractionsContext.DefaultRequestHeaders.Add("x-direct-download", "true");//Save data stream to file:DssStreamResponse streamResponse = extractionsContext.GetReadStream(extractionResult);using (var fileStream = File.Create(dataOutputFile)) streamResponse.Stream.CopyTo(fileStream);//Reset header after direct download from AWS:extractionsContext.DefaultRequestHeaders.Remove("x-direct-download");
Hope this helps. I will soon update the C# samples and tutorials to include AWS downloads.
@Giovanni.Condello, the TRTH C# code samples and C# Tutorials 2 (VBD), 4 (scheduled extraction) and 5 (On Demand extraction) have been updated to allow use of AWS.
This completes what was previously done for the Java samples, which now also allow AWS downloads.
All this is available in the Developer Community, in the TRTH REST API section.
@veerapath.rungruengrayubkul
I need your advice on clients question
How do I use AWS Direct header in C# SDK, had shared the below
var context = new StandardExtractionsContext(new
Uri("https://hosted.datascopeapi.reuters.com/RestApi/v1/"), "<your user id>", "<your password>");
context.DefaultRequestHeaders.Add("x-direct-download", "true");
var stream = context.UserPackageDeliveryOperations.GetReadStream("<packageDeliveryId>");
Client wants to now:-
Is this flag help with some persisted query results?
In fact I'm using ExtractionsContext, not StandardExtractionsContext, and there is no such property DefaultRequestHeaders.
And results for each request are not persisted (no extracted files) in your system.
Does it mean, I don't need this DirectDownload option?