API download of the 'User Submitted Files' zip? | XM Community
Solved

API download of the 'User Submitted Files' zip?

  • 16 July 2019
  • 9 replies
  • 324 views

Userlevel 4
Badge +22
  • Level 4 ●●●●
  • 50 replies
We have an API download of our data in csv format, which gives us links to pages where uploaded pdfs can be viewed.
Is it possible to just download the User Submitted Files through API, instead of manually through the GUI in Data & Analysis/Export & Import/Export Data/User Submitted Files?
Thanks for your help!
icon

Best answer by TomG 17 July 2019, 20:59

View original

9 replies

Userlevel 7
Badge +27
Yes, you would create a web based script to basically automate the manual process you are currently using. You would use the API to download a response export, then find links to uploaded pdfs in the export and use them to retrieve the pdf files.
Userlevel 4
Badge +22
Opening the pdf links requires the login and password to be entered every time, so if we could download the zip file that'd be much more efficient, if possible
Userlevel 7
Badge +27
> @KKI_Neuropsychology said:
> Opening the pdf links requires the login and password to be entered every time, so if we could download the zip file that'd be much more efficient, if possible

I forgot about the login requirement. You should submit a feature request to Qualtrics Support for a download user uploaded files API call.
Userlevel 4
Badge +22
Submitted, I'll update here when they respond. Thanks
Any updates on this? My organization also needs the ability to download the User Submitted Files through API.
Badge

Bump - we need this too!

Badge

Crazy that this isn't a feature, bumping this as well. That and the fact that the login page seems to stay in a loading state as it downloads the file.

Badge

I don't know how recently this Retrieve a User-Uploaded File API method was introduced, but I've just gotten it working in CURL.
Just note that you'll need to specify the output method or you'll get this warning
-----------------------
Warning: Binary output can mess up your terminal. Use "--output -" to tell 
Warning: curl to output it to your terminal anyway, or consider "--output 
Warning: " to save to a file.
-----------------------
Unless you've constrained uploads by type, you'll need to first ascertain the filetype so that you can hard code the file extension.
curl --request GET \\
--url https://ca1.qualtrics.com/API/v3/surveys/surveyId/responses/responseId/uploaded-files/fileId \\
--header 'Content-Type: application/json' \\
--header 'X-API-TOKEN: ' --output respondant1-File1.docx

Hope this helps someone

Badge

I had a similar issue with uploaded files as well and found that if you use a combination of the Q#_URL, Q#_Name, you could easily automate the download using Excel VBA. From there, you could run a zip on the directory (if you'd like).
I created the following which allows you to select the range of files (from the CSV) and in this case, I had other fields that indicated the user's first name (Column C), last name (column D), file extension (extracted from file name (column M)) and the URL for the file (Column P).
I then renamed the file in question to: .
Sub downloadPictures()
  Dim b As Range
  Dim rng As Range, fname As Range, lname As Range, ftype As Range, url1 As Range,
  Dim filename As String, fname_mask As String, dpath As String, strURL As String
  dpath = ""
  Set rng = Selection
  For Each b In rng.Rows
    Dim colnum As Integer
    colnum = b.Row
    Set fname = Range("C" & colnum)
    Set lname = Range("D" & colnum)
    Set ftype = Range("M" & colnum)
    Set url1 = Range("P" & colnum)
    l1 = Len(ftype.Value)
    l2 = InStr(1, ftype.Value, ".", vbTextCompare) - 1
    filename = Left(fname.Value, 1) & lname.Value & Right(ftype.Value, l1 - l2)
    strURL = url1.Value
    Call DownloadFileFromURL(strURL, filename, dpath)
  Next
End Sub

Leave a Reply