更新客戶端服務
請求參數
| 參數 | 類型 | 說明 | 必需的 |
|---|---|---|---|
| action | string | “UpdateClientProduct” | Required |
| serviceid | int | 要更新的客戶端服務的 ID。 | Required |
| pid | int | 與服務關聯的包 ID。 | Optional |
| serverid | int | 與服務關聯的服務器 ID。 | Optional |
| regdate | string | 服務的注冊日期。格式:Y-m-d | Optional |
| nextduedate | string | 服務的下一個到期日。格式:Y-m-d | Optional |
| terminationdate | string | 更新服務的終止日期。格式:Y-m-d | Optional |
| domain | string | 要更改的域名。 | Optional |
| firstpaymentamount | float | 服務的第一筆付款數量。 | Optional |
| recurringamount | float | 自動續訂發票的經常性數量。 | Optional |
| paymentmethod | string | 要關聯的付款方式,采用係統格式(例如 paypal)。 | Optional |
| billingcycle | string | 對產品計費的期限(例如,一次性、每月或每季度)。 | Optional |
| subscriptionid | string | 與服務關聯的訂閱 ID。 | Optional |
| status | string | 要將服務更改為的狀態。 | Optional |
| notes | string | 服務的管理員注釋。 | Optional |
| serviceusername | string | 服務用戶名。 | Optional |
| servicepassword | string | 服務密碼。 | Optional |
| overideautosuspend | string | 是否提供覆蓋自動掛起(‘on’ or ‘off’)。 | Optional |
| overidesuspenduntil | string | 更新服務的覆蓋暫停日期。格式:Y-m-d | Optional |
| ns1 | string | (僅限 VPS/專用服務器) | Optional |
| ns2 | string | (僅限 VPS/專用服務器) | Optional |
| dedicatedip | string | Optional | |
| assignedips | string | (僅限 VPS/專用服務器) | Optional |
| diskusage | int | 磁盤使用量(以 MB 為單位)。 | Optional |
| disklimit | int | 以 MB 為單位的磁盤限製。 | Optional |
| bwusage | int | 以 MB 為單位的帶寬使用量。 | Optional |
| bwlimit | int | 以兆字節為單位的帶寬限製。 | Optional |
| suspendreason | string | Optional | |
| promoid | int | 要關聯的促銷 ID。 | Optional |
| unset | array | 要取消設置的項目數組。可以是以下之一:‘domain’, ‘serviceusername’, ‘servicepassword’, ‘subscriptionid’、‘ns1’, ‘ns2’、‘dedicatedip’, ‘assignedips’, ‘notes’, or ‘suspendreason’ | Optional |
| autorecalc | bool | 是否自動重新計算服務的循環數量(這將忽略任何傳遞的 $recurringamount)。 | Optional |
| customfields | string | 自定義字段值的 Base64 編碼序列化數組 - base64_encode(serialize(array(“1”=>“Yahoo”))); | Optional |
| configoptions | string | Base64 編碼的可配置選項字段值的序列化數組 - base64_encode(serialize(array(configoptionid => dropdownoptionid, XXX => array(‘optionid’ => YYY, ‘qty’ => ZZZ)))) - XXX 是可配置選項 - YYY 是在 tblhostingconfigoption.optionid 中找到的選項 ID - ZZZ 是您要用於該選項的數量 | Optional |
響應參數
| 參數 | 類型 | 說明 |
|---|---|---|
| result | string | 操作結果:成功或錯誤 |
| serviceid | int | 更新服務的 ID。 |
示例請求 (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' => 'UpdateClientProduct',
// See https://developers.whmcs.com/api/authentication
'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
'password' => 'SECRET_OR_HASHED_PASSWORD',
'serviceid' => '1',
'status' => 'Terminated',
'customfields' => base64_encode(serialize(array("1"=>"Yahoo"))),
'configoptions' => base64_encode(serialize(array(configoptionid => dropdownoptionid, XXX => array('optionid' => YYY, 'qty' => ZZZ)))),
'responsetype' => 'json',
)
)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
示例請求(本地 API)
$command = 'UpdateClientProduct';
$postData = array(
'serviceid' => '1',
'status' => 'Terminated',
'customfields' => base64_encode(serialize(array("1"=>"Yahoo"))),
'configoptions' => base64_encode(serialize(array(configoptionid => dropdownoptionid, XXX => array('optionid' => YYY, 'qty' => ZZZ)))),
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);
print_r($results);
示例響應 JSON
{
"result": "success",
"serviceid": "1"
}
錯誤響應
可能的錯誤條件響應包括:
- 未找到服務 ID
相關用法
- PHP WHMCS UpdateClientAddon用法及代碼示例
- PHP WHMCS UpdateClientDomain用法及代碼示例
- PHP WHMCS UpdateClient用法及代碼示例
- PHP WHMCS UpdateContact用法及代碼示例
- PHP WHMCS UpdateUserPermissions用法及代碼示例
- PHP WHMCS UpdateQuote用法及代碼示例
- PHP WHMCS UpdateModuleConfiguration用法及代碼示例
- PHP WHMCS UpdateOAuthCredential用法及代碼示例
- PHP WHMCS UpdatePayMethod用法及代碼示例
- PHP WHMCS UpdateToDoItem用法及代碼示例
- PHP WHMCS UpdateTicketReply用法及代碼示例
- PHP WHMCS UpdateAnnouncement用法及代碼示例
- PHP WHMCS UpdateInvoiceTotal用法及代碼示例
- PHP WHMCS UpdateUser用法及代碼示例
- PHP WHMCS UpdateTransaction用法及代碼示例
- PHP WHMCS UpdateTicket用法及代碼示例
- PHP WHMCS UpdateProject用法及代碼示例
- PHP WHMCS UpdateInvoice用法及代碼示例
- PHP WHMCS UpdateProjectTask用法及代碼示例
- PHP WHMCS UpdateAdminNotes用法及代碼示例
- PHP WHMCS UpgradeProduct用法及代碼示例
- PHP WHMCS UserLogout用法及代碼示例
- PHP WHMCS UserAdd用法及代碼示例
- PHP WHMCS UserEmailVerificationComplete用法及代碼示例
- PHP Unset() vs Unlink()用法及代碼示例
注:本文由純淨天空篩選整理自whmcs.com大神的英文原創作品 UpdateClientProduct。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
