Conversion API

Zoho Writer’s conversion API lets you easily integrate document conversion functionality to web applications and content management systems.

The conversion API allows you to convert a file format (say docx) to another file format (say pdf or text).

Apart from supporting popular file formats like .docx .doc .txt .pdf .odt .sxw and .html. Zoho Writer also enable file conversion in its native .zdoc format. 

Purpose 

To convert a document to any Writer supported format (.docx, .doc, .pdf, .zdoc etc.)

HTTP Request URL

https://writer.zoho.com/writer/officeapi/v1/document/convert

Request Parameters

ParameterData TypeDescription
Mandatory Parameters
apikey423s*****Uniquely identifies the web application which initiates the document conversion request.
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.
output_options{
"format": <String>,
"document_name": <String>,
"password": <String>,
"include_changes":<String>,
"include_comments":<String>
}

format -> Specify the output format in which the converted file needs to be stored.

document_name -> Specify the name for the converted document.

The below key values are optional;

password-> Specify a password if you would like to protect the converted document.

include_changes -> Specify how the track changed content needs to be reflected in converted file. The possible values are:

  • as_markups: If the marked up content needs to included in converted document.
  • all: To generate the converted file by accepting all the track changes done.
  • none: To generate the converted document by rejecting the track changes done.

 

include_comments -> Specify if the comments needs to be included in the converted file or not. The possible values are:

  • all: To generate the converted file with the comments.
  • none: To generate the converted document without the comments.

 

Optional Parameters
passwordStringIf the input document is password protected, specify it using this parameter.

Note:

Users will get a response of the converted document in the form of bytes.

output_options

ParameterTypePossible ValuesDefault Value
Mandatory Parameters
formatStringdocx / zdoc / doc / odt / html / pdf and more ...docx
document_nameStringNANA
Optional Parameters
passwordStringNANA
include_changesStringas_markups / all / noneas_markups
include_commentsStringall / noneall

Conversion API - Error Codes

CodeDescription
1831Error occurred. Parameter value is either incorrect or invalid.
1852File format you're trying to import is not supported.
1868Invalid parameter name for uploaded content.

For a full list of error handling cases in Conversion API, refer here.

Sample Request


				curl -X POST \ 
  'https://writer.zoho.com/writer/officeapi/v1/document/convert?apikey=423s*****' \
  - H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  - F 'document=@/Users/username/Documents/Sample.docx' \
  - F 'output_options={"format":"docx","document_name":"New"}'			

Sample Response

The converted document will be downloaded as bytes.