使用REST API的Docusign DEMO帐户身份验证无效

时间:2016-02-22 01:38:31

标签: php api rest authentication docusignapi

我是Docusign的新手。我有一个开发人员帐户,并尝试使用REST API与PHP建立连接,但我偶然发现错误,错误是调用webservice并且状态为0.以下是我的代码:

$username = "xxxxxx";
$password = "xxxxxx";
$integrator_key = "xxxxxxx";

// construct the authentication header:
$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_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);
//echo $status;
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);

1 个答案:

答案 0 :(得分:0)

这很可能是由您(客户端)端的安全软件,防火墙或其他网络干扰引起的,因为您通过API Explorer发送请求时工作正常。我建议您通过网络跟踪您的请求,以查看它被阻止的位置。