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.
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"
'InputBox "API Response - copy from below", "API Response", objHTTP.responseText
FileDownloadStatus = objHTTP.Status & " - " & objHTTP.statusText
download_full_file = objHTTP.responseText
Should I be expecting the files to be returned in the response text, or are they being physically downloaded somewhere for me to use?