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.
HTTP Request URL
https://{zohoapis_domain}/writer/api/v1/documents/{{document_id}}/mergewithpresets
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 | ||
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. |
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, Recruit 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; url -> Provide the location to which the merge status along with the document information needs to be sent once the 'Merge' operation is completed. retry -> Specify the number of retries required to send the merge status to the provided url. timeout -> Specify the timeout for the given url. expiry_date -> Set the expiry date for the given url. context -> Any data passed inside this key will be sent back to the given url. |
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:
"merge_info": {
//Initially, the response of the output action configured in the template settings will be present. Along with that, the below information will also be included.
"initiator_info": {
“user_id”: <user id who initiated the merge>,
“email_id”: <email address of the user who initiated the merge>,
“initiated_at_ms”: <time stamp>,
“initiated_at”: <formatted date>
}
}
"context": <String>
Note: You can checkout the possible error codes here.
Curl - Sample Request
Copiedcurl --location --request POST "https://www.zohoapis.com/writer/api/v1/documents/ponazfea04477109f4681a831e7177d96bc40/mergewithpresets" \
--header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
--form "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”
}