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.

    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