Create document to Zoho Sign
Table of Contents
Note:
- Each time the zoho.sign.createDocument integration task is executed, it triggers an API request in the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
- Only actual executions that receive a response (whether success or failure) are counted, not the number of times the task appears in the script. For example, if zoho.sign.createDocument integration task is placed inside a for each task that iterates five times, the number of external calls consumed will be five, even though the task appears only once in the script.
Overview
The zoho.sign.createDocument task is used to upload a document to Zoho Sign. This task is based on the Zoho Sign API - Create document.
Syntax
<response> = zoho.sign.createDocument(<files>, <data_map>, <connection>);
where:
| Params> | Data type | Description |
| <response> | KEY-VALUE | The response returned by Zoho Sign that contains document information, creation, and ownership information. |
| <files> | FILE / LIST | The files that will be uploaded. Note: In Zoho Creator, the size of the input files individually cannot be more than 50 MB. |
<data_map>
| KEY-VALUE | Other optional information that can be provided while uploading a document. Note:
|
| <connection> | TEXT | The link name of the connection. Note:
|
Example 1: Create a document with single file
The following script uploads a file to Zoho Sign:
// Fetch file from cloud pdf_file = invokeUrl [ url: "http://www.africau.edu/images/default/sample.pdf" type: GET ]; // Create an empty map to skip the <data_map> parameter dataMap = Map(); // Perform create document task to upload the file to Zoho Sign response = zoho.sign.createDocument(pdf_file, dataMap, "sign_oauth_connection");
where:
response
The KEY-VALUE response that represents file ID, document ID and other relevant information.
pdf_file
The FILE variable that holds the file that will be uploaded.
dataMap
The empty KEY-VALUE variable to skip the <data_map> parameter.
"sign_oauth_connection"
The TEXT that represents the link name of the Zoho Sign connection.
Example 2: Create a document with multiple files
The following script uploads two files as a single document to Zoho Sign:
// Fetch files from cloud file1 = invokeurl [ url :"http://www.africau.edu/images/default/sample.pdf" type :GET ]; file2 = invokeurl [ url :"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" type :GET ]; // Create a list to store the files that will be uploaded filesList = list(); filesList.add(file1); filesList.add(file2); // Create a map to store request name dataMap = Map(); dataMap.put("requests", {"request_name":"My request"}); requestMap =map(); requestMap.put("data", dataMap); // Perform create document task to upload the files response = zoho.sign.createDocument(filesList, requestMap, "sign_oauth_connection");
where:
filesList
The LIST that holds the files that will be uploaded.
requestMap
The KEY-VALUE variable that holds the file name of the request.
"sign_oauth_connection"
The TEXT that represents the link name of the Zoho Sign connection.
Response Format
Success Response
The success response will be returned in the following format:
{
"code":0,
"requests":{
"request_status":"draft",
"owner_email":"john@zylker.com",
"created_time":1512383208303,
"document_ids":[
{
"document_name":"christmas.pdf",
"document_order":"0",
"total_pages":1,
"document_id":"2131000000010001"
}
],
"notes":"",
"self_sign":false,
"owner_id":"2131000000002003",
"description":"",
"request_url":"https://sign.zoho.com/zs#/requests/request/new/2131000000010007?internal=true",
"request_name":"yyy.pdf",
"modified_time":1512383208303,
"is_deleted":false,
"expiration_days":15,
"in_process":false,
"is_sequential":false,
"request_type_name":"Others",
"owner_first_name":"John",
"request_id":"2131000000010007",
"request_type_id":"2131000000000135",
"owner_last_name":"T",
"actions":[ ],
"sign_percentage":0
},
"message":"Document has been added",
"status":"success"
}
To get the Zoho Sign request ID of the uploaded file, execute the following script:
info <response>.get("requests").get("request_id").toLong();
To get the Zoho Sign document ID of the uploaded file, execute the following script:
info <response>.get("requests").get("document_ids").get(0).get("document_id").toLong();