这是我尝试使用的 REST URI,我收到 404 Not Found 错误。
REST Uri 来自 API 文档:/accounts/{accountId}/users/{userId}/profile
这是我发布的 JSON:
{ "companyName" : "公司 ABC", "title" : "项目经理" }
我尝试对在帐户中具有管理员权限的用户和具有用户 ID - e854cadf-9f87-47d9-b9ff-c5b3da80f6f5 的用户进行身份验证。
这是我尝试使用的 REST URI,我收到 404 Not Found 错误。
REST Uri 来自 API 文档:/accounts/{accountId}/users/{userId}/profile
这是我发布的 JSON:
{ "companyName" : "公司 ABC", "title" : "项目经理" }
我尝试对在帐户中具有管理员权限的用户和具有用户 ID - e854cadf-9f87-47d9-b9ff-c5b3da80f6f5 的用户进行身份验证。
对我来说很好。我刚刚进行了测试,并且能够使用您在此处粘贴的相同请求正文使其正常工作。这是适用于我的完整 PHP 程序:
<?php
// Input your info here:
$integratorKey = '***';
$password = '***';
$email = "***";
$name = "***";
$userId = "***";
$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 - Modify User Profile
$data = array( "companyName" => "DocuSign Inc.",
"title" => "Technical Program Manager" );
$data_string = json_encode($data);
$curl = curl_init($baseUrl . "/users/$userId/profile" );
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",
"Accept: application/json",
"X-DocuSign-Authentication: $header" )
);
$response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
echo "PUT request sent, status is $status";
curl_close($curl);
?>