Comparison API
Zoho Writer comparison API provides a user-friendly viewer for comparing documents.
The API accepts a pair of documents as input and returns a comparison viewer URL as a response. When a user accesses the said URL in a browser, the documents are displayed in Writer with changes highlighted.
Purpose
To compare two versions of a document and highlight the difference in text.
HTTP Request URL
https://writer.zoho.com/writer/internal/officeapi/v1/document/compare
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 which initiates the document comparison request. |
document1 or url1 | File or String | Method of providing the input file depending on its location. document1 - if the 1st version of the input file is from your local drive or desktop. url1 - if the 1st version of the input file is from a publicly accessible Web URL. |
document2 or url2 | File or String | Method of providing the input file depending on its location. document2 - if the 2nd version of the input file is from your local drive or desktop. url2 - if the 2nd version of the input file is from a publicly accessible Web URL. |
Optional Parameters | ||
title | String | Defines document title of the 2 versions of comparison files. Note: If the user fails to provide value for 'title' parameter, Zoho Writer will combine the names from 'document1' & 'document2' parameters, and replace it as the title |
lang | String | Enables the editor interface to open in Writer supported languages. Default value: en (English) |
Comparison API - 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 Comparison API, refer here.
Sample Request
Copiedcurl --request POST \
--url 'https://writer.zoho.com/writer/internal/officeapi/v1/document/compare' \
--header 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
--form document1=@/Users/username/Documents/Sample_V1.docx \
--form document2=@/Users/username/Documents/Sample_V2.docx \
--form 'service_id=zohowiki'
Sample Response
Copied{
"compare_url":"https://writer.zoho.com/writer/internal/officeapi/v1/documents/1650f22c990cbbce470e0418a808480021eeffebdad549f3e5226dc8cc83a7fc2e6e38a309785f4b8848a73aca2de5a53752f96243422c0a64aa7795ee7c8c103113db9ef722e86ec3d3b98ed71f1d61/compare",
"session_delete_url":"https://writer.zoho.com/writer/internal/officeapi/v1/sessions/1650f22c990cbbce470e0418a808480021eeffebdad549f3e5226dc8cc83a7fc2e6e38a309785f4b8848a73aca2de5a53752f96243422c0a64aa7795ee7c8c103113db9ef722e86ec3d3b98ed71f1d61"
}