Docusignapi docusign::如何作废“文件”;“进行中”;信封?
请帮忙 我一直试图作废三个签名中有一个签名的“进行中”信封,但我收到了此错误消息。 我遵循以下指示: 我也看了前面的问题,但这对我一点帮助都没有 错误 请求至少包含一个无效参数。信封定义中的“状态”值无效。仅允许“已发送”或“已创建”(默认) URL:*/envelopes/f466ad3f-d391-*--**** 参数:{“状态”:“作废”,“作废原因”:“由于变更请求延迟而作废”。} 无效的\u请求\u参数Docusignapi docusign::如何作废“文件”;“进行中”;信封?,docusignapi,Docusignapi,请帮忙 我一直试图作废三个签名中有一个签名的“进行中”信封,但我收到了此错误消息。 我遵循以下指示: 我也看了前面的问题,但这对我一点帮助都没有 错误 请求至少包含一个无效参数。信封定义中的“状态”值无效。仅允许“已发送”或“已创建”(默认) URL:*/envelopes/f466ad3f-d391-*--**** 参数:{“状态”:“作废”,“作废原因”:“由于变更请求延迟而作废”。} 无效的\u请求\u参数 提前谢谢。你确定你是在做一个PUT请求,而不是POST 刚刚经过测试,使用与您列出
提前谢谢。你确定你是在做一个
PUT
请求,而不是POST
刚刚经过测试,使用与您列出的相同的请求主体,可以很好地作废3个信封,没有问题。不确定您使用的是哪种语言,但这里有一个完整的PHP程序,它可以创建并发送一个信封,这样就可以进行处理,然后立即将其作废
要运行此程序,请执行以下操作:
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);
?>
感谢您的回答,但现在我收到了此消息,请求正文缺失或格式不正确。URL:**/envelopes/3f8fbe05-63f9-418a-****参数:{“状态”:“无效”,“无效原因”:“测试”}无效请求\u正文您使用的是什么语言,以及如何形成JSON?只是硬编码成一个字符串?你的请求肯定有其他问题,我刚刚测试了三次,能够创建一个新的信封,发送它,并在每次都没有问题的情况下作废信封。我将附加一个完整的PHP程序来实现这一点。你需要显示你的相关代码…我有完全相同的问题。我试图在API上提交一个void,结果得到“INVALID_REQUEST_PARAMETER;请求至少包含一个无效参数。信封定义中的'status'值无效。只允许'sent'或'created'(默认值)。”我查看了我的cURL请求并添加了以下行:cURL_setopt($cURL,CURLOPT_CUSTOMREQUEST,'PUT')); 在这之后,虚空很好。谢谢你的发帖,我想发帖的人遇到的是同一个问题,他们只是从来没有接受过答案。。。