Merge and Deliver via Webhook

Purpose

To send or post the merged document to the given webhook URL.

HTTP Request URL

https://writer.zoho.com/writer/officeapi/v1/document/merge/webhook

Request Parameters

ParameterValueDescription
Mandatory Parameters
apikey423s******Uniquely identifies the web application in which the Writer editor is integrated.

Body Parameters

ParameterData TypeDescription
Mandatory Parameters
output_formatStringSupported formats are pdf or docx. Specify a format in which you would like to download the merged document.

file_content

or

file_url

File

or

String

Below are the methods to provide the input file that needs to merged with the data depending on its location.

file_content - if the input file is from your local drive or desktop.

file_url - if the input file is from a publicly accessible Web URL.
webhook

{

"invoke_url" : <url>,

"invoke_period": "oneveryrecord/oncomplete"

}

Pass the values for invoke_url and invoke_period via this parameter as JSON.

Provide the webhook url in which the merged documents needs to be posted in invoke_url and when the merged documents needs to be posted in invoke_period.

merge_toString

Supported merge types are separatedoc and singledoc. Specify in which type you would like to merge the document.

separatedoc - If you would like to merge each record as a separate document.

singledoc- If you would like to merge all the records as a single document.

You can provide the data in any one of the below formats
merge_dataJSONObjectPass a String value through 'data' key as JSON Array.
merge_data_csv_contentFileProvide the required csv content in your API request body.
merge_data_json_contentFileProvide the required json content in your API request body.
merge_data_csv_urlurlProvide the required csv url in your API request body.
merge_data_json_url urlProvide the required json url in your API request body.
Optional Parameters
passwordStringSpecify a password if you would like to protect the merged document.

webhook

ParameterTypePossible ValuesDefault Value
invoke_urlstringURLURL
invoke_periodstring

oncomplete and oneveryrecord.

oncomplete - If you would like to post the merged documents after merging all the records.

oneveryrecord - If you would like to post the merged document of each record once done.

oncomplete

Note: In Sample Response,

1. merge_report_data_url -> helps to get or retrieve the status of the report by passing the {apikey} in 'GET' method.

2. download_link -> helps to download the merged document of a particular record by passing the {apikey} in 'GET' method.

Sample Request


				curl --location --request POST "https://writer.zoho.com/writer/officeapi/v1/document/merge/webhook" \
  --form "apikey=423s*****" \
  --form "output_format=pdf" \
  --form "password=***" \
  --form "webhook={\"invoke_period\":\"oncomplete\",\"invoke_url\":\"https://domain.com/xyz.php\"}" \
  --form "merge_to=separatedoc" \
  --form "file_content=@" \
  --form "merge_data={\"data\":[{\"name\":\"Amelia\",\"email\":\"amelia@zylker.com\"}]}"			

Sample Response


				{
    "merge_report_data_url": "http://writer.zoho.com/writer/officeapi/v1/document/merge/job/0tq5n465132106580437abe99b6f56f2b0c85/data",
    "records": [
        {
	    "name": "Amelia",
            "email": "amelia@zylker.com",
            "download_link": "{url}",
            "status": "inprogress"
        }
    ],
}