Create document to Zoho Sign
Table of Contents
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
pdf_file
dataMap
"sign_oauth_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
requestMap
"sign_oauth_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();