嵌入式签名视图Docusign返回404

时间:2017-07-05 22:53:53

标签: php docusignapi

我正在尝试使用嵌入式签名视图来重定向我的用户,以便他们可以签署文档。我每次发出请求时都会得到一条没有消息的404。除了HTTP代码之外,没有任何响应。发送信封完全没问题,我每次尝试测试时都会收到一封电子邮件。

$data = json_encode(array(
  "returnUrl" => base_url() . "dashboard/home",
  "authenticationMethod" => "email",
  "email" => $this->userEmail,
  "userName" => "seller",
  "clientUserId" => $this->user,
  'recipientId' => '1'
));


$ch = curl_init($this->baseUrl . "/envelope/$this->envelopeId/views/recipient");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  'Content-Type: application/json',
  'Content-Length: ' . strlen($data),
  'X-DocuSign-Authentication: ' . $this->header
  )
);

$resp = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  $headers = curl_getinfo($ch, CURLINFO_HEADER_OUT);

if ($status != 201) {
  error_log($resp);
  die();
}

$response = json_decode($resp, true);
return $response['url'];

我已经关注了Docusign文档中的示例,甚至在另一部分中使用了这个,这只是使用复合模板。我试图搜索嵌入式签名返回404但没有发现任何东西。我会附上错误信息,但它给出的是它收到的404.提前谢谢!

1 个答案:

答案 0 :(得分:2)

您拼错了信封

$ch = curl_init($this->baseUrl . "/envelope/$this->envelopeId/views/recipient");

应该是

$ch = curl_init($this->baseUrl . "/envelopes/$this->envelopeId/views/recipient");

EnvelopeViews:createRecipient的网址应采用以下格式。

  

POST / v2 / accounts / {accountId} / envelope / {envelopeId} / views / recipient

例如,如果您使用的是Sandbox环境,那么您必须对以下网址进行HTTP POST

https://demo.docusign.net/restapi/v2/accounts/{accountId}/envelopes/{envelopeId}/views/recipient