Docusignapi 在docusign的php api中添加组列表

Docusignapi 在docusign的php api中添加组列表,docusignapi,Docusignapi,我无法通过php代码在RESTAPI中添加grouplist <?php // Input your info here: $email = "********* "; // your account email $password = "*****"; // your account password $integratorKey = "********"; // your account integrator key, found on

我无法通过php代码在RESTAPI中添加grouplist

<?php

// Input your info here:
$email = "********* ";          // your account email
$password = "*****";        // your account password
$integratorKey = "********";        // your account integrator key, found on (Preferences -> API page)
$accountID = "********** ";
$debug = $_POST["debug"];


$debug = $_POST["debug"];

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

/////////////////////////////////////////////////////////////////////////////////////////////////
// STEP 1 - Login (to retrieve 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_SSL_VERIFYPEER, 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 logon 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
if ($debug){
echo "<BR>accountId = " . $accountId . "<BR>baseUrl = " . $baseUrl . "<BR>";
}

/////////////////////////////////////////////////////////////////////////////////////////////////
// STEP 2 - status retrieval using filters
/////////////////////////////////////////////////////////////////////////////////////////////////

echo "<BR>Sending new user update...<BR>";

$curl = curl_init($baseUrl . "/users");

if ($debug){
    echo "URL is: " . $baseUrl . "/users" . "<BR>";
    echo "Title: " . $_POST["title"]."<BR>";
    echo "First Name: " . $_POST["firstName"]."<BR>";
    echo "Middle Name: " .$_POST["middleName"]."<BR>";
    echo "Last Name: "  . $_POST["lastName"]."<BR>";
    echo "User Name: " .$_POST["userName"]."<BR>";
    echo "Password :" . $_POST["password"]."<BR>";
    echo "Email: " .$_POST["email"]."<BR>";
    echo "Check box:".$_POST['check_list']."<BR>";

}

$data = array("newUsers" => array
        (
        array
        (
            "lastName" => $_POST["lastName"],
            "firstName" => $_POST["firstName"],
            "password" => $_POST["password"],
            "userName" => $_POST["userName"],
            "email" => $_POST["email"],
            "middleName" => $_POST["middleName"],
            "title" => $_POST["title"],
            "userSettings" => array
            (
                array
                (
                    "name" => "canSendEnvelope",
                    "value" => "true"   
                )
            ),
            "forgottenPasswordInfo" => array
            (
                    "forgottenPasswordQuestion1" => $_POST["forgottenPasswordQuestion1"],
                    "forgottenPasswordAnswer1" => $_POST["forgottenPasswordAnswer1"]
            ),




            "groupList" => array
            (
                    "groupId" => $_POST["check_list"],
                    "groupName" => $_POST["check_list"],
                    "permissionProfileId" => $_POST["check_list"],
                    "groupType" => $_POST["check_list"]
            )

        )
    )
  );



$data_string = json_encode($data);

if ($debug) {
echo "<BR><BR>";
echo $data_string;
echo "<BR><BR>";
}

// build web request
$request_header = array(                                                                          
    'Accept: application/json',
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_string),
    "X-DocuSign-Authentication: $header" );
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, $request_header);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);

//execute web request   
$json_response = curl_exec($curl);

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

$response = json_decode($json_response, true);

//--- display results
if ($debug){
echo "Received " . $response . " end<BR>";
}
echo "New user created."

?>

由于
groupList
是一个数组属性,因此需要分别指定每个组节点。PHP代码生成的JSON应该如下所示:

"groupList": [
    {
        "groupId": "sample string 1",
        "groupName": "sample string 2",
        "permissionProfileId": "sample string 3",
        "groupType": "sample string 4"
    }
],

您能否在if
$debug
检查中发布
$data\u字符串
输出“您无法添加
组列表”
是什么意思?”您是否收到错误消息或具体发生了什么?但我使用grouplist作为数组,并且有多个Grop,我单击了多个Grop,而不是如何在grouplist中分配数组检查值;在组内,我使用了“组”=>array(“groupID”->apple美元))这段代码获取了我的所有组ID,响应也正确,但当我尝试通过docusign检查用户详细信息时,我发现只添加了一个组,即everyone组。我不明白为什么会发生这种情况,在user中还有一件事我可以看到我添加的用户,但当我尝试从组中检查时在现有组中,我找到了我通过登录docusign添加的用户,但我找不到我通过api添加的用户。请为我提供docusign网站中函数的定义指南。请给我一个简短的说明,以便我能够理解我的错误。请发布代码发送的实际JSON请求正文出来几乎不可能在没有看到的情况下进行调试。。。