Choose where you’d like to start

Create document to Zoho Sign

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 typeDescription

<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:
  • The keys to this param need to be given as specified in Zoho Sign API.
  • To skip this param, specify an empty map. 

<connection>

TEXT

The link name of the connection.

Note:

  • In view of stopping new authtoken generation, a Zoho OAuth connection with appropriate scopes is mandatory in order for new integration tasks (created after the deadline specified in the post) to work as expected. Existing integration tasks will continue to work with or without the connections parameter until you manually delete the authtoken from accounts.
  • Add relevant scopes mentioned in Zoho Sign API document while creating the connection.
  • Refer to this post for the list of Zoho services that support the connections page.
  • Learn more about connections

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();

Related Links

Get Started Now

Execute