0
我的應用程序使用邏輯與EchoSign(更改收件人)一起處理當前收件人。 我需要能夠檢索信封使用DocuSign API的當前收件人。怎麼可能?獲取信封的當前收件人
我的應用程序使用邏輯與EchoSign(更改收件人)一起處理當前收件人。 我需要能夠檢索信封使用DocuSign API的當前收件人。怎麼可能?獲取信封的當前收件人
你應該從DocuSign Developer Center開始,這是一個很好的API資源。如果您閱讀開發中心的快速入門部分,您將看到API工具部分,該部分提供了免費代碼示例,向您展示如何執行「獲取收件人狀態」等操作。
的API演練對如何獲取當前收件人狀態的例子。這裏是完整的PHP示例:
<?php
// Input your info here:
$email = "***"; // your account email
$password = "***"; // your account password
$integratorKey = "***"; // your account integrator key, found on (Preferences -> API page)
// copy the envelopeId from an existing envelope in your account that you want to query:
$envelopeId = 'cbe279f6-199c-.................';
// 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 "\naccountId = " . $accountId . "\nbaseUrl = " . $baseUrl . "\n";
/////////////////////////////////////////////////////////////////////////////////////////////////
// STEP 2 - Get envelope information
/////////////////////////////////////////////////////////////////////////////////////////////////
$data_string = json_encode($data);
$curl = curl_init($baseUrl . "/envelopes/" . $envelopeId . "/recipients");
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 . "\nError text --> ";
print_r($json_response); echo "\n";
exit(-1);
}
$response = json_decode($json_response, true);
//--- display results
echo "First signer = " . $response["signers"][0]["name"] . "\n";
echo "First Signer's email = " . $response["signers"][0]["email"] . "\n";
echo "Signing status = " . $response["signers"][0]["status"] . "\n\n";
?>
我會找到一種方法,可以做到這一點,而無需獲取列表中的所有收件人和每個檢查狀態。但現在你的解決方案是有效的。感謝您的迴應。 – korvinko 2014-11-08 22:59:00