更新给定的 OAuth API 客户端凭据。
请求参数
参数 | 类型 | 说明 | 必需的 |
---|---|---|---|
action | string | “UpdateOAuthCredential” | Required |
credentialId | int | 要更新的凭证集的自增 ID | Required |
clientApiIdentifier | string | 要更新的 OAuth API 客户端凭据唯一标识符(客户端 ID)。仅当 credentialId 未知/未通过时才需要。 | Optional |
name | string | 要分配的名称 | Optional |
description | string | 要分配的说明 | Optional |
grantType | string | 凭证集对其有效的授权类型。可能的值包括:authorization_code 或 single_sign_on |
Optional |
scope | string | 凭据集对其有效的范围的空格分隔列表。看CreateOAuthCredential对于允许值 | Optional |
serviceId | int | 凭证相关的服务 ID | Optional |
logoUri | string[] | he logoUri 分配 | Optional |
redirectUri | string | 一组授权重定向 URI | Optional |
resetSecret | bool | 设置为 true 以重置 OAuth API 客户端凭据密码 | Optional |
响应参数
参数 | 类型 | 说明 |
---|---|---|
result | string | 操作结果:成功或错误 |
credentialId | int | 凭据集的自动增量 ID |
newClientSecret | string | 仅当 resetSecret 作为 true 传递时才存在 |
示例请求 (CURL)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
http_build_query(
array(
'action' => 'UpdateOAuthCredential',
// See https://developers.whmcs.com/api/authentication
'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
'password' => 'SECRET_OR_HASHED_PASSWORD',
'credentialId' => '1',
'name' => 'Credential name',
'resetSecret' => true,
'responsetype' => 'json',
)
)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
示例请求(本地 API)
$command = 'UpdateOAuthCredential';
$postData = array(
'credentialId' => '1',
'name' => 'Credential name',
'resetSecret' => true,
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);
print_r($results);
示例响应 JSON
{
"result": "success",
"credentialId": "1",
"newClientSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
错误响应
可能的错误条件响应包括:
- 需要凭据 ID 或客户端标识符。
- 提供的凭据 ID 无效。
- 提供的客户端标识符无效。
- 请求的授权类型“xxxxx” 无效。
- 需要客户端凭据的名称。
- 单个 sign-on 授权类型需要服务 ID。
- 请求的范围 “xxxxxxx” 无效。
相关用法
- PHP WHMCS UpdateUserPermissions用法及代码示例
- PHP WHMCS UpdateQuote用法及代码示例
- PHP WHMCS UpdateModuleConfiguration用法及代码示例
- PHP WHMCS UpdateClientProduct用法及代码示例
- PHP WHMCS UpdatePayMethod用法及代码示例
- PHP WHMCS UpdateToDoItem用法及代码示例
- PHP WHMCS UpdateTicketReply用法及代码示例
- PHP WHMCS UpdateClientAddon用法及代码示例
- PHP WHMCS UpdateAnnouncement用法及代码示例
- PHP WHMCS UpdateInvoiceTotal用法及代码示例
- PHP WHMCS UpdateUser用法及代码示例
- PHP WHMCS UpdateTransaction用法及代码示例
- PHP WHMCS UpdateTicket用法及代码示例
- PHP WHMCS UpdateContact用法及代码示例
- PHP WHMCS UpdateProject用法及代码示例
- PHP WHMCS UpdateInvoice用法及代码示例
- PHP WHMCS UpdateClientDomain用法及代码示例
- PHP WHMCS UpdateClient用法及代码示例
- PHP WHMCS UpdateProjectTask用法及代码示例
- PHP WHMCS UpdateAdminNotes用法及代码示例
- PHP WHMCS UpgradeProduct用法及代码示例
- PHP WHMCS UserLogout用法及代码示例
- PHP WHMCS UserAdd用法及代码示例
- PHP WHMCS UserEmailVerificationComplete用法及代码示例
- PHP Unset() vs Unlink()用法及代码示例
注:本文由纯净天空筛选整理自whmcs.com大神的英文原创作品 UpdateOAuthCredential。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。