Merge and Deliver via Webhook
Purpose
This API is used to deliver the merge documents via Webhook for custom handling by consumers.
HTTP Request URL
https://{zohoapis_domain}/writer/api/v1/documents/{{document_id}}/merge/webhook
Path Parameters
Parameter | Data Type | Description |
Mandatory Parameters | ||
document_id | String | Specify a unique id for the writer document. |
Body Parameters
Parameter | Data Type | Description |
Mandatory Parameters | ||
output_format | String | Supported formats are pdf, pdfform and docx. Specify a format in which you would like to download the merged document. |
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_to | String | 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_data | JSONObject | Pass a String value through 'data' key as JSON Array. |
merge_data_csv_content | File | Provide the required csv content in your API request body. |
merge_data_json_content | File | Provide the required json content in your API request body. |
merge_data_csv_url | url | Provide the required csv url in your API request body. |
merge_data_json_url | url | Provide the required json url in your API request body. |
Optional Parameters | ||
password | String | Specify a password if you would like to protect the merged document. |
test_mode | Boolean (true/false) | Using this param, you can test the Merge APIs without consuming any credit points. The output file will contain a watermark as it is used only for testing purpose. Test mode limit: 50 merges/day for an org. |
webhook
Parameter | Type | Possible Values | Default Value |
invoke_url | string | URL | URL |
invoke_period | string | 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 |
Sample Request
Copiedcurl --location --request POST "https://zohoapis.com/writer/api/v1/documents/ponazfea04477109f4681a831e7177d96bc40/merge/webhook" \
--header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
--form "output_format=pdf" \
--form "password=***" \
--form "webhook={\"invoke_period\":\"oncomplete\",\"invoke_url\":\"https://facebook.com\"}" \
--form "merge_to=separatedoc" \
--form "merge_data={\"data\":[{\"name\":\"Amelia\",\"email\":\"amelia@zylker.com\"}]}"
Sample Response
Copied{
"merge_report_data_url": "http://writer.zoho.com/writer/api/v1/merge/job/0tq5n465132106580437abe99b6f56f2b0c85/data",
"merge_report_url": "http://writer.zoho.com/writer/v1/mailmerge/job/0tq5n465132106580437abe99b6f56f2b0c85",
"records": [
{
"name": "Amelia",
"email": "amelia@zylker.com",
"download_link": "{url}",
"status": "inprogress"
}
],
}