Download document using the API | Community
Skip to main content
lgaertner
Level 9
June 27, 2023
Solved

Download document using the API

  • June 27, 2023
  • 2 replies
  • 3419 views

Hello,

 

I would like to download the binary of a document via the API to get a blob object. 

Is this somehow possible? I cannot find the corresponding information using the API-explorer.

I know, that I can retrieve the field downloadURL, but using this requires to be logged in to Workfront.

 

Thanks in advance.

 

Regards

Lars

Best answer by ChrisStephens

That's what you have to do. You have to get the download url, and then download it with that url, and both of those require an API key or a session ID.

2 replies

ChrisStephens
Community Advisor
ChrisStephensCommunity AdvisorAccepted solution
Community Advisor
June 27, 2023

That's what you have to do. You have to get the download url, and then download it with that url, and both of those require an API key or a session ID.

Level 3
March 13, 2024

How can I get the file extension in the endpoint -  /attask/api/v17.0/document/search?projectID=xxxxxxxxx&fields=folders,downloadURL . I tried adding fileType, but I'm getting below message.

 

"field 'fileType' is not available"
Could you please help?
ChrisStephens
Community Advisor
Community Advisor
March 13, 2024

The file Type parameter is on the version object, so if you include currentVersion:ext, that should give it to you.

Level 1
April 2, 2024

I am also having a problem downloading a document. I am providing an apiKey (I've tried in both $body and $header) in a CURL command through Powershell.

The $url variable contains something like this:
https://<mycompany>.my.workfront.com/internal/document/download?ID=abc123456def123456
$downloadResponse = Curl -Uri $url -Header $header -Body $body -OutFile $downloadPath

All I am getting back is a 4k file, starting with this:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 
<body onload="document.forms[0].submit()">
<noscript>
<p>
<strong>Note:</strong> Since your browser does not support JavaScript,
you must press the Continue button once to proceed.
</p>
</noscript>

 

July 18, 2024

Having the exact same error. If i open the provided URL in my browser it downloads just fine; but trying to do it programmatically produces an error.

 

Were you able to solve the issue?