Home  »   Remote API Reference »  Zoho Viewer APIs »  View a Private Document

View a Private Document

Tags:  

Zoho Viewer will close at the end of 2012. Please read our announcement for more details. Use Zoho Writer, Sheet and Show APIs instead.

To view a private document, you can post the document to Zoho Viewer as a multi-part form submit and get back a temporary URL to view the document.

Request:

You would need to send a HTTPS POST request with the file to Zoho Viewer. Here is a sample form and the supported parameters.
<form name="myform" action="https://viewer.zoho.com/api/view.do" method="post" enctype="multipart/form-data">
<input type="hidden" name="apikey" value="your_api_key_here"/>
<input type="file" name="file" size="38"/>
<input type="submit" name="submit" value="Upload"/>
</form>
Here are the possible parameters for this API:

Parameter Required Description
apikey Mandatory Your API Key. If you don't have one, get it here.
file Mandatory The file to be viewed.
redirect
Optional
true - If you want to directly view the file after the POST succeeds. Useful if the POST is done from the user's browser.
false - If you want to POST the file and get the temporary URL of the document in Zoho Viewer which can be viewed online.
Default is false if not provided.
displayfilenameOptionalThis parameter is used to show / hide the file name at the top of the document viewer page. This is useful when this view page is embedded in your application and you already display the name of the file in your web page.
true
- Will display the name of the file
false - Will hide the
name of the file
Default is true if not provided
displaylinks
Optional
This parameter is used to show / hide the links at the top of the document viewer page.
true
- Will display the links such as Save, Edit, Export, Print, etc.
false - Will hide the links such as Save, Edit, Export, Print, etc.
Default is true if not provided
linkoptions
Optional
This parameter is used to selectively hide / show the links at the top of the document viewer page.

This is used in conjunction with the displaylinks parameter. If displaylinks is true, then you can hide selective links by passing this parameter. If displaylinks is false, then you can show selective links by passing this parameter.

Here are a few examples:

1) The following will hide the link to the Edit and Print tools.

displaylinks="true"
linkoptions="edit=false,print=false"

2) The following will show just the SlideShow link for a presentation document.

displaylinks="false"
linkoptions="slideshow=true"

Here are the various keys to be used for the links displayed.

Link
Key
Save (or) Downloaddownload
Edit
edit
Export
export
Printprint
SlideShowslideshow

If you want to hide just a particular file format in the Export menu, say Export HTML for example, then you can do the following.

displaylinks="true"
linkoptions="export.html=false"

Other file formats in Export can be hidden in the same way.

Response:

If the redirect parameter in the POST request is false, then the response will be in JSON form at.

Here is a sample response upon success:
{
"response":
{
"result":"Success",
"url":"https://viewer.zoho.com/apidoc/gmgt1kaFmgt1kaF"
}
}
And here is a sample response upon failure:
{
"response":
{
"result":"Failure",
"error":
{
"code":5833,
"message":"Server Error while processing the request"
}
}
}
You can refer to the possible error codes and messages in the Error Codes section.

Note: This document will temporarily reside on our servers and will be deleted as soon as the user closes the browser window after viewing the file. Only 1 view will be allowed per file uploaded. If it is viewed for the 2nd time, it will be deleted on our servers and the file content will not be displayed. Apart from this, there is a schedule running daily which checks and deletes the undeleted documents uploaded using our APIs.

Is there a limit to the number of times you can send documents for instant, private viewing using the above API per developer key?

Meaning, could I setup a scenario, where every time a user wants to view a doc online, I initiate an upload to zoho using this API, and then show the user?

Thanks
hades310 1228 - days ago 
In private, I must use <input type="file" name="file" size="38"/> for upload file. Can you show me any way do not need it.
sonic119 1169 - days ago 
when I use these API to view document contain Chinese characters, it shows Unrecognizable Code.
Guest 1148 - days ago 
Are there zoho APIs for document conversion?

DC Chaudhary
Research Engineer

Dataresolve Technologies
Salt Lake,
Kolkata, India

http://www.dataresolve.com
Guest 1100 - days ago 
The note on this page:

"Note: This document will temporarily reside on our servers and will be deleted as soon as the user closes the browser window after viewing the file. Only 1 view will be allowed per file uploaded. If it is viewed for the 2nd time, it will be deleted on our servers and the file content will not be displayed. Apart from this, there is a schedule running daily which checks and deletes the undeleted documents uploaded using our APIs."

differs from what the Viewer-FAQ states about the time a document resides on zoho servers:

Q: For how long will the uploaded document be available?
A: The uploaded document will be available on our servers until the expiry time set for the document elapses. If the expiry as set as "Do not expire", then the document will be permanently available on our servers unless it is deleted upon request. As soon as you upload your document, you will see a Delete link at the top. You can use it to delete your document. This Delete link will be available only for the first time you view it after uploading. If you want the document to be deleted at a later stage, you can send an email to support at zohoviewer dot com along with the URL of your document

So, which statement is true now, for private documents posted to the viewer-api?
Can someone please clarify?

Thanks,
Michael
Guest 1022 - days ago 
aaaaaaa
Guest 963 - days ago 
Error code 5833
Guest 961 - days ago 
What if the link requires a user name password? It doesn't work at the moment.
torilogbon 891 - days ago 
I keep getting Error Occurred message for some doc files, but it works well with pdf. What could be wrong? This just started happening
Eusabia Roseline Rozario 890 - days ago 
@torilogbon: We have fixed the issue. .doc files will work now. Please check it.

Regards,
Roseline
Post a comment

Your Name or E-mail ID (mandatory)

Note: Your comment will be published after approval of the owner.





 RSS of this page