Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • TRTH /
avatar image
REFINITIV
Question by Beera.Rajesh · Jul 13, 2020 at 05:11 PM · trthv2excel vbatrthv2 rest apidownload file

Tick History Time and Sales data through Microsoft VBA, facing issue in downloading zipped files & mentioning file path for downloads.

The client is able to make it work for ‘smaller’ reports – e.g. a Terms and Conditions report, where the returned data is relatively small but not for a Tick History file, specifically around the downloading of Tick History where the files are zipped.

The client is following TRTHv2 API scheduled Workflow: using the ExtractedFIles(fileid)/$value method.

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

where my ExtractedFileID is ‘VjF8MHgwNzI5NjU1MzE1YzZiMGM2fA’ under ExtractionID ‘2000000162175976’.

This corresponds to the following schedule:

I can download the output file manually on the web interface, and I can download the corresponding Notes file via the API, but when I run the API GET against the main output – the zipped file - I get a ‘200-OK’ status but just a couple of odd characters in the response text:


I am using the ‘gzip, deflate’ option in my request:

Function download_full_file(FileDownloadURL As String, TRTHToken As String, FileExtractionID As String, FileDownloadStatus As String) As String


Dim objHTTP As New MSXML2.XMLHTTP

Dim FileDownloadURLwithID As String

Dim cutresponse As String

FileDownloadURLwithID = Replace(FileDownloadURL, "xxExtractedFileIdx", FileExtractionID)

objHTTP.Open "GET", FileDownloadURLwithID, False

objHTTP.setRequestHeader "Authorization", "Token " & TRTHToken

objHTTP.setRequestHeader "X-Direct-Download", "true"

objHTTP.setRequestHeader "Accept-Encoding", "gzip, deflate"

objHTTP.setRequestHeader "Accept-Charset", "UTF-8"

objHTTP.setRequestHeader "Prefer", "respond-async"

objHTTP.send

'InputBox "API Response - copy from below", "API Response", objHTTP.responseText

FileDownloadStatus = objHTTP.Status & " - " & objHTTP.statusText

download_full_file = objHTTP.responseText

End Function

Should I be expecting the files to be returned in the response text, or are they being physically downloaded somewhere for me to use?

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Reply

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by veerapath.rungruengrayubkul · Jul 14, 2020 at 07:03 AM

Hi @Beera.Rajesh,

The data extracted from TimeAndSales report template is in gzip format, so responseText contains binary gzip data. The client can write the response to a .gz file, and then decompress data from the .gz file outside of the application.

Below is the sample of code writing response to a .gz file.

        filePath = "C:\\temp\\response.gz"
        fileBytes = objHTTP.responseBody
        Open filePath For Binary As #1
        Put #1, , fileBytes
        Close #1
Comment
pankaj

People who like this

1 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
12 People are following this question.

Related Questions

TRTH REST API - Could you please provide python API code to retrieve extraction ID and also Python code to download extracted file.

I am receiving "Resource not found for the segment 'ExtractedFiles '."}}

Is it possible to use the US-West-1 link in AWS for the VBD downloads?

time stamp differences between trth v1 and trth v2.

TRTH on demand request, how to handle embargo

  • Feedback
  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Careers
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Calais
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRIT
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • World-Check Data File
  • Explore
  • Tags
  • Questions
  • Badges