Preview Document
Purpose
To open a document in preview or read-only mode in Zoho Writer.
HTTP Request URL
https://writer.zoho.com/writer/internal/officeapi/v1/document/preview
Request Parameters
| Parameter | Data Type | Description |
| Mandatory Parameters | ||
| service_id | zohowiki / zohofinance / zohorecruit / zohoworkerly / zohocontracts / zohocrm / zohopeople / zohoconnect / zohomail / zohocampaigns / zohomarketingautomation / zohocliq / zohobigin / zohocalendar | Uniquely identifies the product in which the Writer editor is integrated. |
| document or url | File or String | Method of providing the input file depending on its location. document - if the input file is from your local drive or desktop. url - if the input file is from a publicly accessible Web URL. |
| Optional Parameters | ||
| lang | String | Enables the editor interface to open in Writer supported languages. Default value: en (English) |
| document_info | { "document_name":"New" } | Set a display name for the document. |
| permissions | { "document.print":true, } | Define document permissions for user. Option to allow or revoke document "Print" access. |
Preview Document - Error Codes
| Code | Description |
| 1831 | Error occurred. Parameter value is either incorrect or invalid. |
| 1852 | File format you're trying to import is not supported. |
| 1868 | Invalid parameter name for uploaded content. |
For a full list of error handling cases in Preview Document, refer here.
Sample Request
Copiedcurl --request POST \
--url 'https://writer.zoho.com/writer/internal/officeapi/v1/document/preview' \
--header 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
--form document=@/Users/username/Documents/Sample.docx \
--form 'service_id=zohowiki' \
--form lang=enSample Response
Copied{
"preview_url": "https://writer.zoho.com/writer/internal/officeapi/v1/documents/d26aa7b8029bf4f8d34c7dd0013939237c7426dd7b014b7c5cd9fa07cdd21f0e304693ffbf26ba091b4f8d5350ec9bb8/preview",
"session_id": "d26aa7b8029bf4f8d34c7dd0013939237c7426dd7b014b7c5cd9fa07cdd21f0e304693ffbf26ba091b4f8d5350ec9bb8",
"document_id": "1349",
"session_delete_url":
"https://writer.zoho.com/writer/internal/officeapi/v1/sessions/d26aa7b8029bf4f8d34c7dd001393923ec7a56cea9631855c708129cbd74491775f200eb5821ba0193ab987c514887c4",
"document_delete_url": "https://writer.zoho.com/writer/internal/officeapi/v1/documents/1349"
}