繁体   English   中英

是否可以通过Java API检索Docusign模板或Power Form字段

[英]Is it possible to retrieve Docusign Templates or Power Form fields through Java API

我一直在使用Docusign API,但我只能找到有关请求签名或检索文档的信息。

我有一些通过一些pdf生成的模板创建的powerform。 我想做的就是以某种方式检索模板或powerform,以便我可以提取字段并将它们映射到另一个系统。 这样,在提交powerform时,我可以通过connect获取文档,然后可以根据映射将字段存储在单独的系统中。 我正在通过一组Java服务来完成所有这些工作。

使用API​​甚至可以做到这一点,如果可以,那么以前有人做过类似的事情吗?或者您可以向我指出任何示例或文档的方向吗?

在此先感谢您的帮助或建议,Derm

编辑

作为对此的更新,我确实尝试使用了

https://demo.docusign.net/restapi/v2/accounts/xxxxxx/templates

获取我所有的模板ID,然后

https://demo.docusign.net/restapi/v2/accounts/xxxxxx/templates/{template-id}

获取模板定义。 在REST开发人员指南中,示例响应看起来具有一个customfields部分

"customFields":{
    "listCustomFields":[{
        "name":"String content",
        "required":"String content",
        "show":"String content",
        "value":"String content",
        "listItems":["String content"]
    }],
    "textCustomFields":[{
        "name":"String content",
        "required":"String content",
        "show":"String content",
        "value":"String content" 
    }]
},

但是,我没有在响应中看到任何这样的部分(下面的示例数据x'd出)。 我确实在模板中添加了一些示例自定义字段,所以想知道为什么没有返回自定义字段,或者我是否可能未正确指定它们?

{  "envelopeTemplateDefinition": 
  {    "templateId": "xxx",    
     "name": "xxx",    
     "shared": "true",    
     "password": "",    
     "description": "",    
     "lastModified": "xxx",    
     "pageCount": x,    
     "uri": "xxx",    
     "folderName": "xxx",    
     "folderId": "xxx",    
     "folderUri": "xxx",    
     "owner": {      
          "userName": "xxx",      
          "email": "xxx",      
          "userId": "xxx"    
     }  
  },  
  "documents": [    
   {      
     "documentId": "xxx",      
     "uri": "xxx",      
     "name": "xxx",      
     "order": "xxx",      
     "pages": "xxx"    
   }  
  ],  
  "recipients": 
  {    
     "signers": [      
     {        
          "defaultRecipient": "xxx",        
          "signInEachLocation": "xxx",        
          "name": "",        
          "email": "",        
          "recipientId": "xxx",        
          "accessCode": "",        
          "requireIdLookup": "xxx",        
          "routingOrder": "1",        
          "note": "",        
          "roleName": "xxx",        
          "templateLocked": "xxx",        
          "templateRequired": "xxx",        
          "inheritEmailNotificationConfiguration": "xxx"      
     }     
     ],    
     "agents": [],    
     "editors": [],    
     "intermediaries": [],    
     "carbonCopies": [],    
     "certifiedDeliveries": [],    
     "inPersonSigners": [],    
     "recipientCount": "1"  
  },  
  "notification": 
  {    
     "reminders": 
     {      
         "reminderEnabled": "xxx",      
         "reminderDelay": "0",      
         "reminderFrequency": "0"    
     },    
     "expirations": 
     {      
          "expireEnabled": "xxx",      
          "expireAfter": "xxx",      
          "expireWarn": "0"    
     }  
  },  
  "emailSubject": "xxx",  
  "emailBlurb": "",  
  "signingLocation": "xxx",  
  "authoritativeCopy": "xxx",  
  "enforceSignerVisibility": "xxx",  
  "enableWetSign": "xxx",  
  "allowMarkup": "xxx"
}

如果有人对为什么customFields部分可能会从上方丢失的想法有个了解,那就太好了。 目前,我将尝试下面的Kims方法(感谢Kim!),看看是否涵盖了我正在尝试做的事情...

DocuSign开发人员中心( http://www.docusign.com/developer-center )包含有关使用DocuSign API的大量信息-一定也要进行检查(除了您已经找到的REST API指南) )。

关于您所描述的场景(即,想要使用API​​确定在DocuSign模板中定义了哪些字段),这当然是可能的。 只需执行将querysting参数include_tabs设置为trueGet Recipients请求,并在请求URL中包含Envelope ID通常所在的位置,然后包含Template ID。 例如:

GET https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes/{{templateId}}/recipients?include_tabs=true&include_extended=true

该响应将包括为模板指定的所有接收者角色,以及对于每个接收者角色,属于接收者角色的选项卡(字段)。 这是一个包含两个收件人角色(均为type = signer )的模板的示例响应,每个收件人角色都拥有多个不同类型的选项卡(字段):

{
    "signers": [
        {
            "tabs": {
                "signHereTabs": [
                    {
                        "name": "SignHere",
                        "tabLabel": "Sign Here",
                        "scaleValue": 1,
                        "optional": "false",
                        "documentId": "1",
                        "recipientId": "1",
                        "pageNumber": "1",
                        "xPosition": "10",
                        "yPosition": "100",
                        "tabId": "15311994-b09a-4ea5-b24d-d185875ba378"
                    },
                    {
                        "name": "Sign Here",
                        "tabLabel": "Signature 8",
                        "scaleValue": 1,
                        "optional": "false",
                        "documentId": "2",
                        "recipientId": "1",
                        "pageNumber": "1",
                        "xPosition": "71",
                        "yPosition": "107",
                        "tabId": "ff79b73d-ad5b-423c-9a37-70547e928100"
                    }
                ],
                "initialHereTabs": [
                    {
                        "name": "Initial Here",
                        "tabLabel": "Initial 31",
                        "scaleValue": 1,
                        "optional": "false",
                        "documentId": "3",
                        "recipientId": "1",
                        "pageNumber": "1",
                        "xPosition": "75",
                        "yPosition": "106",
                        "tabId": "6be4892d-a2d2-4f50-b0ff-0acd5108dc6d"
                    }
                ],
                "textTabs": [
                    {
                        "height": 11,
                        "validationPattern": "",
                        "validationMessage": "",
                        "shared": "false",
                        "requireInitialOnSharedChange": "false",
                        "name": "Text",
                        "value": "",
                        "width": 42,
                        "required": "true",
                        "locked": "false",
                        "concealValueOnDocument": "false",
                        "disableAutoSize": "false",
                        "tabLabel": "Address",
                        "bold": "false",
                        "italic": "false",
                        "underline": "false",
                        "documentId": "1",
                        "recipientId": "1",
                        "pageNumber": "1",
                        "xPosition": "108",
                        "yPosition": "142",
                        "tabId": "0039105d-2a47-4937-874f-00307c54bca4"
                    },
                    {
                        "height": 11,
                        "validationPattern": "",
                        "validationMessage": "",
                        "shared": "false",
                        "requireInitialOnSharedChange": "false",
                        "name": "Text",
                        "value": "",
                        "width": 42,
                        "required": "true",
                        "locked": "false",
                        "concealValueOnDocument": "false",
                        "disableAutoSize": "false",
                        "tabLabel": "City",
                        "bold": "false",
                        "italic": "false",
                        "underline": "false",
                        "documentId": "1",
                        "recipientId": "1",
                        "pageNumber": "1",
                        "xPosition": "180",
                        "yPosition": "142",
                        "tabId": "1f071721-fe91-49cd-ab43-a316548adea6"
                    },
                    {
                        "height": 11,
                        "validationPattern": "",
                        "validationMessage": "",
                        "shared": "false",
                        "requireInitialOnSharedChange": "false",
                        "name": "Text",
                        "value": "",
                        "width": 42,
                        "required": "true",
                        "locked": "false",
                        "concealValueOnDocument": "false",
                        "disableAutoSize": "false",
                        "tabLabel": "State",
                        "bold": "false",
                        "italic": "false",
                        "underline": "false",
                        "documentId": "1",
                        "recipientId": "1",
                        "pageNumber": "1",
                        "xPosition": "250",
                        "yPosition": "142",
                        "tabId": "687f4dc4-736d-4a45-b195-29b44b7cb8a9"
                    },
                    {
                        "height": 11,
                        "validationPattern": "",
                        "validationMessage": "",
                        "shared": "false",
                        "requireInitialOnSharedChange": "false",
                        "name": "Text",
                        "value": "",
                        "width": 42,
                        "required": "true",
                        "locked": "false",
                        "concealValueOnDocument": "false",
                        "disableAutoSize": "false",
                        "tabLabel": "Zip",
                        "bold": "false",
                        "italic": "false",
                        "underline": "false",
                        "documentId": "1",
                        "recipientId": "1",
                        "pageNumber": "1",
                        "xPosition": "343",
                        "yPosition": "142",
                        "tabId": "e94a42fc-a38b-4536-a25a-008db64376a3"
                    }
                ],
                "radioGroupTabs": [
                    {
                        "documentId": "1",
                        "recipientId": "1",
                        "groupName": "IsUSCitizen",
                        "radios": [
                            {
                                "pageNumber": "1",
                                "xPosition": "328",
                                "yPosition": "195",
                                "value": "Yes",
                                "selected": "false",
                                "tabId": "8cd7c1c3-41d3-4803-9a25-d4798e4f8465",
                                "required": "True",
                                "locked": "False"
                            },
                            {
                                "pageNumber": "1",
                                "xPosition": "328",
                                "yPosition": "217",
                                "value": "No",
                                "selected": "false",
                                "tabId": "c8481da7-5bf3-4648-a002-feb5b697746c",
                                "required": "True",
                                "locked": "False"
                            }
                        ]
                    }
                ]
            },
            "signInEachLocation": "false",
            "name": "",
            "email": "",
            "recipientId": "1",
            "recipientIdGuid": "dd9dda12-13a8-4f91-ba77-f9427ce9c4c6",
            "requireIdLookup": "false",
            "routingOrder": "1",
            "roleName": "Signer1",
            "status": "created",
            "templateLocked": "false",
            "templateRequired": "false"
        },
        {
            "tabs": {
                "signHereTabs": [
                    {
                        "name": "Sign Here",
                        "tabLabel": "Signature 9",
                        "scaleValue": 1,
                        "optional": "false",
                        "documentId": "2",
                        "recipientId": "e3a92e6d-1533-4785-a814-2e4e7f96bef5",
                        "pageNumber": "1",
                        "xPosition": "71",
                        "yPosition": "194",
                        "tabId": "fd8eff65-105f-46ae-9f28-305790c9d4e7"
                    }
                ],
                "initialHereTabs": [
                    {
                        "name": "Initial Here",
                        "tabLabel": "Initial 32",
                        "scaleValue": 1,
                        "optional": "false",
                        "documentId": "3",
                        "recipientId": "e3a92e6d-1533-4785-a814-2e4e7f96bef5",
                        "pageNumber": "1",
                        "xPosition": "75",
                        "yPosition": "154",
                        "tabId": "b01922a7-f20a-4dc4-9327-96e592733ca9"
                    }
                ],
                "numberTabs": [
                    {
                        "validationPattern": "",
                        "validationMessage": "",
                        "shared": "false",
                        "requireInitialOnSharedChange": "false",
                        "name": "Text",
                        "value": "",
                        "width": 42,
                        "required": "true",
                        "locked": "false",
                        "concealValueOnDocument": "false",
                        "disableAutoSize": "false",
                        "tabLabel": "Quantity",
                        "bold": "false",
                        "italic": "false",
                        "underline": "false",
                        "documentId": "1",
                        "recipientId": "e3a92e6d-1533-4785-a814-2e4e7f96bef5",
                        "pageNumber": "1",
                        "xPosition": "43",
                        "yPosition": "396",
                        "tabId": "37cfcb7d-4357-4c6b-a9b8-500e5e9dc9b6"
                    }
                ],
                "listTabs": [
                    {
                        "listItems": [
                            {
                                "text": "Regular",
                                "value": "Regular",
                                "selected": "false"
                            },
                            {
                                "text": "Express",
                                "value": "Express",
                                "selected": "false"
                            }
                        ],
                        "value": "",
                        "width": 78,
                        "shared": "false",
                        "requireInitialOnSharedChange": "false",
                        "tabLabel": "ShippingMethod",
                        "bold": "false",
                        "italic": "false",
                        "underline": "false",
                        "documentId": "1",
                        "recipientId": "e3a92e6d-1533-4785-a814-2e4e7f96bef5",
                        "pageNumber": "1",
                        "xPosition": "121",
                        "yPosition": "395",
                        "tabId": "6f663d22-3632-486b-a1f5-7455c665b9d8"
                    }
                ]
            },
            "signInEachLocation": "false",
            "name": "",
            "email": "",
            "recipientId": "e3a92e6d-1533-4785-a814-2e4e7f96bef5",
            "recipientIdGuid": "e3a92e6d-1533-4785-a814-2e4e7f96bef5",
            "requireIdLookup": "false",
            "routingOrder": "2",
            "roleName": "Signer2",
            "status": "created",
            "templateLocked": "false",
            "templateRequired": "false"
        }
    ],
    "agents": [],
    "editors": [],
    "intermediaries": [],
    "carbonCopies": [],
    "certifiedDeliveries": [],
    "inPersonSigners": [],
    "recipientCount": "2"
}

DocuSign REST API指南(您在注释中链接到该指南)包含有关各种选项卡类型以及每种选项卡类型包含的属性的信息。

我知道它对此帖子的回复很晚,但是它可能会帮助其他需要的人。 我正在使用REST Api从docusig帐户检索签名的文档。

//获取文档详细信息

$email = "enter your associated docusign account email";

$password = "enter your associated docusign account password";

$integratorKey = "enter your associated docusign account integrated key";

//将您的帐户信息传递到标题中

$header = "<DocuSignCredentials><Username>" . $email . "</Username><Password>" . $password . "</Password><IntegratorKey>" . $integratorKey . "</IntegratorKey></DocuSignCredentials>";

//从docusign模拟账户获取文档

$url = "https://demo.docusign.net/restapi/v2/login_information";

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("X-DocuSign-Authentication: $header"));

$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ( $status != 200 ) {
    $status = false;
}

$response = json_decode($json_response, true);
$accountId = $response["loginAccounts"][0]["accountId"];
$baseUrl = $response["loginAccounts"][0]["baseUrl"];
curl_close($curl);       

// get document
$documentId = 1;  //provide your document id
$curl = curl_init($baseUrl . "/envelopes/" . $envelopeID . "/documents/". $documentId."?show_changes=" );
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
   'Content-Type: application/pdf',
   "X-DocuSign-Authentication: $header" )
);

$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ( $status != 200) {
            $status = false;
}
curl_close($curl);

//您可以在此处打印您的回复,或者如果您想另存为pdf,则可以添加以下代码

$path = APPLICATION_PATH  . 'your path';
$filename ="your file name";


chmod("$path", 0777);
file_put_contents("$path/$filename", $json_response);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM