Merge with Presets
Purpose
This API facilitates the execution of merge operations according to the configured template settings. The output response will vary based on the template configuration.
Quick Reference
| Property | Value |
|---|---|
| Method | POST |
| Request URL | https://{zohoapis_domain}/writer/api/v1/documents/{document_id}/mergewithpresets |
| Scopes | ZohoWriter.documentEditor.ALL, ZohoWriter.merge.ALL, ZohoPC.files.ALL, WorkDrive.files.ALL |
| Rate Limit | See Writer API throttle limits |
Parameters
Path Parameters
| Parameter | Data Type | Description |
|---|---|---|
| document_id | String | Specify a unique id for the writer document. |
Body Parameters
| Parameter | Data Type | Description |
|---|---|---|
| Mandatory Parameters | ||
| Merge Data — pass data using 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. |
| record_id | String | Instead of using merge_data, you can pass the record_id and we will fetch the data internally. Note: This is applicable only for Zoho CRM, Creator and Bigin templates. Maximum length allowed: 25 |
| Optional Parameters | ||
| webhook_info | { "url": <URL>, "retry":<Integer>, "timeout": <Integer>, "expiry_date": <timestamp>, "context": <String> } | Using this param, you will be able to specify the following;
|
| 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 info
| Parameter | Type | Possible Values | Default Value |
|---|---|---|---|
| url | string | URL - Maximum length -> 255 | URL |
| retry | integer | 0 to 4 | 0 |
| timeout | integer | 1 to 120000 milliseconds | 120000 milliseconds |
| context | string | Maximum characters allowed = 1000 |
url
Once the merge operation is completed, the merge status along with the document information will be sent back to the given url with the following key names:
| Key Name | Type | Description |
|---|---|---|
| merge_info | JSONObject | It contains the user details who initiated the merge along with the response of the output action configured in the template settings. |
| context | String | Data that is passed via 'context' key inside 'webhook_info' param will be present here. |
Sample Structure:
Notes
- For possible errors, refer to error codes.
Curl - Sample Request
Copiedcurl -X POST "https://www.zohoapis.com/writer/api/v1/documents/{document_id}/mergewithpresets" \
-H "Authorization: Zoho-oauthtoken <ACCESS_TOKEN>" \
-F "merge_data={\"data\":[{\"name\":\"Amelia\",\"email\":\"amelia@zylker.com\"}]}"
Deluge Snippet
Copieddatamap = Map();
datamap.put("InvoiceNo","12345");
datamap.put("InvoiceDate","27 May 2022");
datamap.put("InvoiceAmount","$100");
param = Map();
param.put("merge_data",{"data":datamap});
response = invokeurl
[
url :"https://www.zohoapis.com/writer/api/v1/documents/olce2ef696f1810ee46ed8331f25aaece75dd/mergewithpresets"
type :POST
parameters:param
connection:"<connection_name>"
];
info response;The response will vary based on the output action configured in the template settings.
Sample Response: Merge and Email
Copied{
"action":"email”,
"merge_report_data_url": "<url to fetch the report data>",
"merge_report_url": "<report page url>",
"records": [
{
"data": {
"name": "Amelia",
"email": "amelia@zylker.com"
},
"download_link": "<attachment download url>",
"status": "inprogress"
}
],
}
Sample Response: Merge and Store
Copied{
"action":"store",
"merge_report_data_url": "<url to fetch the report data>",
"merge_report_url": "<report page url>",
"records": [
{
"data": {
"name": "Amelia",
"email": "amelia@zylker.com"
},
"download_link": "<attachment download url>",
"document_id": "<merged document id>",
"document_url": "<merged document open url>",
"status": "inprogress"
}
],
“status”: “inprogress”
}Sample Response: Merge and Sign
Copied{
"action":"sign",
"merge_report_data_url": "<url to fetch report data>",
"merge_report_url": "<report page url>",
"records": [
{
"data": {
"name": "Amelia",
"email": "amelia@zylker.com"
},
"download_link": "<attachment download url>",
"sign_request_id":12345****",
"status": "inprogress"
}
],
}Sample Response: Merge and Invoke
Copied{
"action":"execute_custom_function",
"merge_report_data_url": "<url to fetch report data>",
"merge_report_url": "<report page url>",
"records": [
{
“data”: {
"name": "Amelia",
"email": "amelia@zylker.com"
},
"download_link": "<attachment download url>",
"status": "inprogress"
}
],
}Sample Response: Merge and Share Fillable Link
Copied{
"merge_report_data_url": "<url to fetch report data>",
"merge_report_url": "<report page url>",
"records": [
{
"data": {
"name": "Amelia",
"email": "amelia@zylker.com"
},
"fillable_link": "{url}",
"status": "inprogress"
}
],
“action”: “fill”
}