獲得符合通過條件的促銷活動
請求參數
參數 | 類型 | 說明 | 必需的 |
---|---|---|---|
action | string | “GetPromotions” | Required |
code | string | 檢索特定的促銷代碼。不通過檢索所有 | Optional |
響應參數
參數 | 類型 | 說明 |
---|---|---|
result | string | 操作結果:成功或錯誤 |
totalresults | int | 可用結果總數 |
promotions | array | 符合通過條件的促銷代碼數組 |
示例請求 (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' => 'GetPromotions',
// See https://developers.whmcs.com/api/authentication
'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
'password' => 'SECRET_OR_HASHED_PASSWORD',
'responsetype' => 'json',
)
)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
示例請求(本地 API)
$command = 'GetPromotions';
$postData = array(
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);
print_r($results);
示例響應 JSON
{
"result": "success",
"totalresults": 1,
"promotions": {
"promotion": [
{
"id": 1,
"code": "sample",
"type": "Percentage",
"recurring": 1,
"value": 10,
"cycles": "",
"appliesto": "1,2",
"requires": "1,2",
"requiresexisting": 0,
"startdate": "0000-00-00",
"expirationdate": "0000-00-00",
"maxuses": 0,
"uses": 1,
"lifetimepromo": 0,
"applyonce": 0,
"newsignups": 0,
"existingclient": 0,
"onceperclient": 0,
"recurfor": 0,
"upgrades": 0,
"upgradeconfig": "a:4:{s:5:\"value\";s:4:\"0.00\";s:4:\"type\";s:0:\"\";s:12:\"discounttype\";s:10:\"Percentage\";s:13:\"configoptions\";s:0:\"\";}",
"notes": ""
}
]
}
}
相關用法
- PHP WHMCS GetProducts用法及代碼示例
- PHP WHMCS GetProjects用法及代碼示例
- PHP WHMCS GetProject用法及代碼示例
- PHP WHMCS GetPermissionsList用法及代碼示例
- PHP WHMCS GetPaymentMethods用法及代碼示例
- PHP WHMCS GetPayMethods用法及代碼示例
- PHP WHMCS GetTicketNotes用法及代碼示例
- PHP WHMCS GetUsers用法及代碼示例
- PHP WHMCS GetTLDPricing用法及代碼示例
- PHP WHMCS GetToDoItemStatuses用法及代碼示例
- PHP WHMCS GetCurrencies用法及代碼示例
- PHP WHMCS GetStaffOnline用法及代碼示例
- PHP WHMCS GetEmails用法及代碼示例
- PHP WHMCS GetClientPassword用法及代碼示例
- PHP WHMCS GetRegistrars用法及代碼示例
- PHP WHMCS GetAutomationLog用法及代碼示例
- PHP WHMCS GetQuotes用法及代碼示例
- PHP WHMCS GetActivityLog用法及代碼示例
- PHP WHMCS GetModuleQueue用法及代碼示例
- PHP WHMCS GetTickets用法及代碼示例
- PHP WHMCS GetInvoices用法及代碼示例
- PHP WHMCS GetServers用法及代碼示例
- PHP WHMCS GetSupportStatuses用法及代碼示例
- PHP WHMCS GetHealthStatus用法及代碼示例
- PHP WHMCS GetTicketAttachment用法及代碼示例
注:本文由純淨天空篩選整理自whmcs.com大神的英文原創作品 GetPromotions。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。