This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Templates


Overview

The following operations allow you to work with templates. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with templates, see Sample configuration.

OperationDescription

listTemplates

Gets a list of templates

getTemplate

Gets the definition of the specified template

Operation details

This section provides details on each of the operations.

Listing the templates

The listTemplates operation allows you to retrieve the list of templates for the specified account. 

listTemplates
<docusign.listTemplates>
     <accountId>{$ctx:accountId}</accountId>
     <count>{$ctx:count}</count>
     <folder>{$ctx:folder}</folder>
     <folderIds>{$ctx:folderIds}</folderIds>
     <fromDate>{$ctx:fromDate}</fromDate>
     <include>{$ctx:include}</include>
     <order>{$ctx:order}</order>
     <orderBy>{$ctx:orderBy}</orderBy>
     <searchText>{$ctx:searchText}</searchText>
     <shared>{$ctx:shared}</shared>
     <sharedByMe>{$ctx:sharedByMe}</sharedByMe>
     <startPosition>{$ctx:startPosition}</startPosition>
     <toDate>{$ctx:toDate}</toDate>
     <usedFromDate>{$ctx:usedFromDate}</usedFromDate>
     <usedToDate>{$ctx:usedToDate}</usedToDate>
     <userFilter>{$ctx:userFilter}</userFilter>
     <optionalParameters>{$ctx:optionalParameters}</optionalParameters>
</docusign.listTemplates>
Properties
  • accountId :  The account ID whose templates you want to retrieve. The account ID is returned in the login response.

  • count : Number of records to return in the cache.
  • folder : The query value can be a folder name or folder ID. The response will only return templates in the specified folder.
  • folderIds: A comma separated list of folder ID GUIDs.
  • fromDate: Start of the search date range. Only returns templates created on or after this date/time. If no value is specified, there is no limit on the earliest date created.
  • include: A comma-separated list of additional template attributes to include in the response. Valid values are: custom_fields, documents, folders, notifications, recipients.
  • order :Sets the direction order used to sort the list. Valid values are: - asc = ascending sort order (a to z) , desc = descending sort order (z to a).
  • orderBy :Sets the file attribute used to sort the list. Valid values are: -name: template name -modified: date/time template was last modified. -used: date/time the template was last used.
  • searchText : The search text used to search the names of templates.
  • sharedByMe : (Boolean value)If true, the response only includes templates shared by the user. If false, the response only returns template not shared by the user. If not specified, the response is not affected.
  • startPosition : The starting index for the first template shown in the response. This must be greater than or equal to 0 (zero).
  • toDate :End of the search date range. Only returns templates created up to this date/time. If no value is provided, this defaults to the current date.
  • usedFromDate: Start of the search date range. Only returns templates used or edited on or after this date/time. If no value is specified, there is no limit on the earliest date used.
  • usedToDate : End of the search date range. Only returns templates used or edited up to this date/time. If no value is provided, this defaults to the current date.
  • userFilter :  Sets if the templates shown in the response Valid values are:- owned_by_me: only shows templates the user owns, shared_with_me: only shows templates that are shared with the user, all: shows all templates owned or shared with the user.
  • optionalParameters : Add all or new optional parameters as appended url parameter. 

    Note

    If you have any new parameter which is introduced by DocuSign API in future you can send those parameters as follows.
       "optionalParameters" : count=3&order=desc&order_by=name

Sample request

Following is a sample REST request that can be handled by the listTemplates operation.

listTemplates
{
	"apiUrl":"https://demo.docusign.net",
	"apiVersion":"v2",
    "integratorKey":"37f2a694-cf45-4cb3-8ee6-1396b9e75739", 
    "userName":"thulas@gmail.com",
    "password":"XXXXXXXXXXXXX",
    "accountId":"1910007",
	"count":"3",
	"include":"documents",
	"order":"asc",
	"sharedByMe":"true",
	"userFilter":"owned_by_me",
	"startPosition":"0",
    "optionalParameters" : "count=3&order=desc&order_by=name"
}
Related DocuSign API documentation

https://docs.docusign.com/esign/restapi/Templates/Templates/list/

Getting a template definition

The getTemplate operation allows you to retrieve the definition of the specified template.

getTemplate
<docusign.getTemplate>
    <accountId>{$ctx:accountId}</accountId>
    <templateId>{$ctx:templateId}</templateId>
</docusign.getTemplate>
Properties
  • accountId: The ID of the account whose template definition you want to retrieve. The account ID is returned in the login response.

  • templateId: The ID of the template to retrieve.
Sample request

Following is a sample REST request that can be handled by the getTemplate operation.

getTemplate
{
	"apiUrl":"https://demo.docusign.net",
	"apiVersion":"v2",
    "integratorKey":"37f2a694-cf45-4cb3-8ee6-1396b9e75739", 
    "userName":"thulas@gmail.com",
    "password":"XXXXXXXXXXXXX",
	"accountId":"1910007",
	"templateId":"374b471f-8d4b-4fab-89b2-5948776a542d"
}
Related DocuSign API documentation

https://docs.docusign.com/esign/restapi/Templates/Templates/get/

Sample configuration

Following is a sample proxy service that illustrates how to connect to DocuSign with the init operation and use the listTemplates operation. The sample request for this proxy can be found in listTemplates sample request. You can use this sample as a template for using other operations in this category.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="createList"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence>
        <property name="apiUrl" expression="json-eval($.apiUrl)"/>
		<property name="apiVersion" expression="json-eval($.apiVersion)"/>
        <property name="integratorKey" expression="json-eval($.integratorKey)"/>      
        <property name="userName" expression="json-eval($.userName)"/>
        <property name="password" expression="json-eval($.password)"/>		
        <property name="blocking" expression="json-eval($.blocking)"/>
		<property name="accountId" expression="json-eval($.accountId)"/>
      	<docusign.init>
    		<apiUrl>{$ctx:apiUrl}</apiUrl>
    		<apiVersion>{$ctx:apiVersion}</apiVersion>
            <integratorKey>{$ctx:integratorKey}</integratorKey>    
            <userName>{$ctx:userName}</userName>
            <password>{$ctx:password}</password>    		
        	<blocking>{$ctx:blocking}</blocking>
	    </docusign.init>
       <docusign.listTemplates>
    		<accountId>{$ctx:accountId}</accountId>
	   </docusign.listTemplates>
         <respond/>
      </inSequence>
      <outSequence>
         <log/>
         <send/>
      </outSequence>
   </target>
   <parameter name="serviceType">proxy</parameter>
</proxy>