REST API: How can i download a document?
Comments
-
Have a look at /nodes/{id}/content, please.
0 -
Just to expound on Ferdinandi's answer: I had the same challenge. My project is a ColdFusion solution that integrates with Content Server. Here is the call I use to grab a file from our Content Server and download it to our ColdFusion server.
The reference above says to use "/nodes/{id}/content/{filename}" with both id and filename as required inputs. It seemed odd to provide the filename as an input parameter, but whatever it works...most of the time. I found that if the filename has spaces, the call fails. However, if you remove the filename from the URL call, it still works...at least so far. The filename is still needed, but as a cfhttp parameter.
Prior to using the code below, I have a cfhttp call that logs into CS and a second that gets the details of the node (which includes the filename). I can share those as well, if needed.
<cfhttp method="GET" url="http://{your cs server}/livelink/api/v1/nodes/#cs_node_id#/content" file="#new_local_filename#" path="#drive_and_path#" result="downloadInfo"> <cfhttpparam type="header" name="OTCSTICKET" value="#cookie.TICKET#"> </cfhttp>
0 -
About the
{filename}
path parameter:This parameter is optional; the documentation is wrong. If there is one more path element after the
/content
in the URL, the server ignores it, assuming that it is a file name.If you write a server-to-server application, you do not need to provide the
filename
. This parameter is used by the CS UI Widgets and can be used by web-browser UIs, which support file download using the REST API. This parameter was added to offer more convenient file download - the File-Save-As dialog should offer a real file name to the user. The browser should parse the file name from theContent-Disposition
response header for that. However, some IE versions ignored the header and offered the last part of the URL path as the file name. Appending an unused file name at the end of the path was a workaround for this problem.0 -
I tried the command "/nodes/{id}/content", then what? How do I save the file with javascript?
0 -
Ok I got it!!
jQuery ajax is not able to handle binary responses properly (can't set responseType),
so it's better to use a plain XMLHttpRequest call0
Categories
- All Categories
- 122 Developer Announcements
- 53 Articles
- 149 General Questions
- 148 Thrust Services
- 56 OpenText Hackathon
- 35 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 917 Cloud Fax and Notifications
- 84 Digital Asset Management
- 9.4K Documentum
- 31 eDOCS
- 181 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 8 XM Fax
- Follow Categories