1

请帮忙。

我一直试图用三个签名中的一个签名作废一个“进行中”的信封,但我收到了这个错误消息。我按照以下说明操作:http: //www.docusign.com/p/RESTAPIGuide/Content/REST%20API%20References/Void%20Envelope.htm

还查看了上一个问题,但这对我没有帮助。

错误 请求包含至少一个无效参数。信封定义中的“状态”值无效。只允许“发送”或“创建”(默认)。

网址:https ://demo.docusign.net/restapi/v2/accounts/35 * /envelopes/f466ad3f-d391- * --* * ** *

参数:{"status":"voided","voidedReason":"由于延迟更改请求而作废。"} INVALID_REQUEST_PARAMETER

提前致谢。

4

1 回答 1

3

你确定你在做一个PUT请求而不是一个POST

刚刚经过测试,使用与您列出的相同请求正文,能够毫无问题地取消 3 个信封。不确定您使用的是什么语言,但这里有一个完整的 PHP 程序,它创建并发送一个信封,因此它是在进程中的,然后它立即将其无效。

要运行此程序:

  1. 将代码另存为本地文件,例如“test.php”。
  2. 在顶部输入凭据(电子邮件、密码、集成商密钥、姓名)
  3. 将测试PDF文档复制到同一目录,重命名为“document.pdf”
  4. php test.php在命令行上运行

这是代码,不要忘记替换凭据...

<?php

    // Input your info here:
    $integratorKey = '***';
    $email = '***';
    $password = '***';
    $name = '***';

    // 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_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 - Create an envelope with one recipient, one tab, and one document and send
    /////////////////////////////////////////////////////////////////////////////////////////////////
    $data = array (
            "emailBlurb" => "Custom PHP script",
            "emailSubject" => "Radio Buttons Testing",
            "status" => "sent",
            "documents" => array(array( "documentId" => "1", "name" => "document.pdf")),
            "recipients" => array( "signers" => array(
                    array( "email" => $email,
                            "name" => "$name",
                            "recipientId" => "1",
                            "clientUserId" => "1001",
                            "tabs" => array(
                                    "signHereTabs" => array(
                                        array(
                                            "xPosition" => "100",
                                            "yPosition" => "200",
                                            "documentId" => "1",
                                            "pageNumber" => "1"
                                         )
                                    ),
                                    "radioGroupTabs" => array(
                                        array (
                                            "documentId" => "1",                                        
                                            "groupName" => "RadioGroup1",
                                            "radios" => array (
                                                array(
                                                    "pageNumber" => "1",
                                                    "selected" => "false",
                                                    //"value" => "X",
                                                    "xPosition" => "300",
                                                    "yPosition" => "75"
                                                    ),
                                                array(
                                                    "pageNumber" => "1",
                                                    "selected" => "false",
                                                    "xPosition" => "350",
                                                    "yPosition" => "75"
                                                    )
                                                )
                                            )
                                        )
                                    )
                                )
                        )
                ) 
        );

    $data_string = json_encode($data);  

    $file_contents = file_get_contents("document.pdf");

    $requestBody = "\r\n"
    ."\r\n"
    ."--myboundary\r\n"
    ."Content-Type: application/json\r\n"
    ."Content-Disposition: form-data\r\n"
    ."\r\n"
    ."$data_string\r\n"
    ."--myboundary\r\n"
    ."Content-Type:application/pdf\r\n"
    ."Content-Disposition: file; filename=\”document.pdf\"; documentid=1 \r\n"
    ."\r\n"
    ."$file_contents\r\n"
    ."--myboundary--\r\n"
    ."\r\n";

    // *** append "/envelopes" to baseUrl and as signature request endpoint
    $curl = curl_init($baseUrl . "/envelopes" );
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $requestBody);                                                                  
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(                                                                          
        'Content-Type: multipart/form-data;boundary=myboundary',
        'Content-Length: ' . strlen($requestBody),
        "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 "Document is sent! Envelope ID = " . $envelopeId . "\n"; 

    /////////////////////////////////////////////////////////////////////////////////////////////////
    // STEP 3 - Get the Embedded Singing View 
    /////////////////////////////////////////////////////////////////////////////////////////////////   
    $data = array("status" => "voided", "voidedReason" => "test");
    $data_string = json_encode($data);    

    echo "Attempting to void envelope $envelopeId\nVoid request body is:  $data_string\n";

    $curl = curl_init($baseUrl . "/envelopes/$envelopeId" );
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
    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 != 200 ) {
        echo "error calling webservice, status is:" . $status . "\nerror text is --> ";
        print_r($json_response); echo "\n";
        exit(-1);
    }

    $response = json_decode($json_response, true);

    echo "Done.\n";
    curl_close($curl);
?>
于 2013-10-10T06:34:01.097 回答