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                                                                                                                                                          

ParameterData TypeDescription
Mandatory Parameters
document_idStringSpecify a unique id for the writer document.

Body Parameters  

ParameterData TypeDescription
Mandatory Parameters
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
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_modeBoolean (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

ParameterTypePossible ValuesDefault Value
urlstringURL - Maximum length -> 255URL
retryinteger0 to 40
timeoutinteger1 to 120000 milliseconds120000 milliseconds
contextstringMaximum 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 NameTypeDescription
merge_infoJSONObjectIt contains the user details who initiated the merge along with the response of the output action configured in the template settings.
contextStringData 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

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”
}