【问题标题】:REST API Embedded Signing -DocusignREST API 嵌入式签名 -Docusign
【发布时间】:2020-12-04 17:51:57
【问题描述】:

我正在使用 REST API 进行嵌入式签名。我已经创建了带有标签的模板并将它们设置为必填字段,但是在将文档嵌入网站进行签名时,我看不到我在模板中设置的标签。我通过在 API 代码 (http://iodocs.docusign.com/APIWalkthrough/embeddedSigning - php) 中设置模板 ID 创建了这个信封。这是代码

<?php

// Input your info:
$email = "email address";           
$password = "password";     
$integratorKey = "integrator key";      
$recipientName = "signer name";     
$templateId = "template ID";        
$templateRoleName = "template Role Name";   
$clientUserId = "client ID";    

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

/////////////////////////////////////////////////////////////////////////////////////////////////
// STEP 1 - Login (retrieves baseUrl and accountId)
/////////////////////////////////////////////////////////////////////////////////////////////////
$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 ) {
    echo "error calling webservice, status is:" . $status;
    exit(-1);
}

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

//--- display results
echo "accountId = " . $accountId . "\nbaseUrl = " . $baseUrl . "\n";



/////////////////////////////////////////////////////////////////////////////////////////////////
// STEP 2 - Create an envelope with an Embedded recipient (uses the clientUserId property)
/////////////////////////////////////////////////////////////////////////////////////////////////
$data = array("accountId" => $accountId, 
    "emailSubject" => "DocuSign API - Embedded Signing Example",
    "templateId" => $templateId, 
    "templateRoles" => array(
        array( "roleName" => $templateRoleName, "email" => $email, "name" => $recipientName, "clientUserId" => $clientUserId )),
    "status" => "sent");                                                                    

$data_string = json_encode($data);  
$curl = curl_init($baseUrl . "/envelopes" );
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);                                                                  
curl_setopt($curl, CURLOPT_HTTPHEADER, array(                                                                          
    'Content-Type: application/json',                                                                                
    'Content-Length: ' . strlen($data_string),
    "X-DocuSign-Authentication: $header" )                                                                       
);

$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ( $status != 201 ) {
    echo "error calling webservice, status is:" . $status . "\nerror text is --> ";
    print_r($json_response); echo "\n";
    exit(-1);
}

$response = json_decode($json_response, true);
$envelopeId = $response["envelopeId"];
curl_close($curl);

//--- display results   
echo "Envelope created! Envelope ID: " . $envelopeId . "\n"; 

/////////////////////////////////////////////////////////////////////////////////////////////////
// STEP 3 - Get the Embedded Singing View 
/////////////////////////////////////////////////////////////////////////////////////////////////
$data = array("returnUrl" => "http://www.docusign.com/devcenter",
    "authenticationMethod" => "None", "email" => $email, 
    "userName" => $recipientName, "clientUserId" => $clientUserId
);                                                                    

$data_string = json_encode($data);    
$curl = curl_init($baseUrl . "/envelopes/$envelopeId/views/recipient" );
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);                                                                  
curl_setopt($curl, CURLOPT_HTTPHEADER, array(                                                                          
    'Content-Type: application/json',                                                                                
    'Content-Length: ' . strlen($data_string),
    "X-DocuSign-Authentication: $header" )                                                                       
);

$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ( $status != 201 ) {
    echo "error calling webservice, status is:" . $status . "\nerror text is --> ";
    print_r($json_response); echo "\n";
    exit(-1);
}

$response = json_decode($json_response, true);
$url = $response["url"];

//--- display results
echo "Embedded URL is: \n\n" . $url . "\n\nNavigate to this URL to start the embedded signing view of the envelope\n"; 

?

如果我使用相同的模板直接从模拟账户发送信封,它会显示我设置的所有标签。为什么会发生这种情况,是否有任何其他设置可以显示模板中的标签。

【问题讨论】:

  • 请提供源码,方便调试
  • 听起来您在通话中声明的角色名称与您的模板不匹配。
  • @Andrew Wilson 如何检查角色名称是否与我的模板匹配。我需要为登录我网站的用户嵌入一个用于登录网站的文档。创建模板时,我只提供了一个用于设置标签的签名者姓名和电子邮件地址。如何在模板中为所有网站用户设置标签?
  • 您能否在信封上执行 GET 以查看已应用的角色名称并将其发布在此处?

标签: php api docusignapi


【解决方案1】:

只需在管理面板中设置模板的角色并从那里删除收件人。您将获得嵌入视图中的所有选项卡。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多