Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Docusignapi Docusign中没有数据填充_Docusignapi - Fatal编程技术网

Docusignapi Docusign中没有数据填充

Docusignapi Docusign中没有数据填充,docusignapi,Docusignapi,因为我不熟悉DocuSign API。在发送电子邮件时,我在DocuSign模板中填充预数据时遇到问题。此外,当我从代码模板字段中添加动态收件人时,字段将变为空白,而不是附加数据并发送给用户。请,有人能帮我吗 下面是我的代码: <?php // Input your info here: $name = ""; $email = ''; $integratorKey = ''; $password = ''; $email1 = 'testmail@gmail.com'; $templat

因为我不熟悉DocuSign API。在发送电子邮件时,我在DocuSign模板中填充预数据时遇到问题。此外,当我从代码模板字段中添加动态收件人时,字段将变为空白,而不是附加数据并发送给用户。请,有人能帮我吗

下面是我的代码:

<?php
// Input your info here:
$name = "";
$email = '';
$integratorKey = '';
$password = '';
$email1 = 'testmail@gmail.com';
$templateId = "826e138e-7ad6-4ceb-853b-f545be643527";

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

$url = "https://demo.docusign.net/restapi/v2/login_information";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
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);

$data = array(
    "accountId" => $accountId,
    "emailSubject" => "DocuSign Templates Webinar - Example 2",
    "emailBlurb" => "Example #2 - Dynamically Populate Form Fields",
    "templateId" => $templateId,
    "templateRoles" => array(
        array(
            "email" => $email,
            "name" => $name,
            "roleName" => "Developer",
            "tabs" => array(
                "textTabs" => array(
                    array(
                        "tabLabel" => "ApplicantSSN",
                        "value" => "test test456456"
                    ) ,
                )
            )
        )
    ) ,
    "status" => "sent"
);

$data_string = json_encode($data);
$curl = curl_init($baseUrl . "/envelopes");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
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);
echo "<pre>";
print_r($json_response);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

if ($status != 201){
    print_r($json_response);
    echo "\n";
    exit(-1);
}

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

// To add recipients in docusign
$data1 = json_encode(array(
    "signers" => array(
        array(
            "email" => $email1,
            "name" => 'jkl',
            "roleName" => "Signer",
            "recipientId" => 5000
        )
    )
));
$curl = curl_init($baseUrl . "/envelopes/" . $envelopeId . "/recipients");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data1) ,
    "X-DocuSign-Authentication: $header"
));
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data1);
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$response = json_decode($json_response, true);
?>

按照下面的步骤和上面的代码,它将按预期工作

1.登录到您的演示帐户
2.删除角色的收件人名称和电子邮件,只留下角色名称。

这在Docusign支持团队之后对我有效。