Home

View a Private Document using Zoho Viewer API

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 HTTP POST request with the file to Zoho Viewer. Here is a sample form and the supported parameters.
<form name="myform" action="http://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.

Response:

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

Here is a sample response upon success:
{
"response":
{
"result":"Success",
"url":"http://viewer.zoho.com/temp/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.