為項目啟動計時器
請求參數
參數 | 類型 | 說明 | 必需的 |
---|---|---|---|
action | string | “StartTaskTimer” | Required |
timerid | int | 待結束任務的id | Required |
projectid | int | 任務計時器的項目 ID | Required |
adminid | int | 與計時器關聯的管理員 ID | Optional |
start_time | int | 作為 unix 時間戳的開始時間。如果未提供,則默認為 time() | Optional |
end_time | int | 作為 unix 時間戳的開始時間。 | Optional |
響應參數
參數 | 類型 | 說明 |
---|---|---|
result | string | 操作結果:成功或錯誤 |
message | string | '開始計時器已設置' |
示例請求 (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' => 'StartTaskTimer',
// See https://developers.whmcs.com/api/authentication
'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
'password' => 'SECRET_OR_HASHED_PASSWORD',
'projectid' => '1',
'timerid' => '1',
'adminid' => '2',
'responsetype' => 'json',
)
)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
示例請求(本地 API)
$command = 'StartTaskTimer';
$postData = array(
'projectid' => '1',
'timerid' => '1',
'adminid' => '2',
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);
print_r($results);
示例響應 JSON
{
"result": "success",
"message": "Start Timer Has Been Set"
}
錯誤響應
可能的錯誤條件響應包括:
- 項目 ID 為必填項
- 未找到項目 ID
- 未設置定時器 ID
- 未找到計時器 ID
- 未找到管理員 ID
相關用法
- PHP String wordwrap()用法及代碼示例
- PHP String sprintf()用法及代碼示例
- PHP String ucwords()用法及代碼示例
- PHP String substr()用法及代碼示例
- PHP String localeconv()用法及代碼示例
- PHP String strstr()用法及代碼示例
- PHP String htmlspecialchars_decode()用法及代碼示例
- PHP String sscanf()用法及代碼示例
- PHP String strtr()用法及代碼示例
- PHP String ucfirst()用法及代碼示例
- PHP String quoted_printable_encode()用法及代碼示例
- PHP String substr_compare()用法及代碼示例
- PHP String nl2br()用法及代碼示例
- PHP String vsprintf()用法及代碼示例
- PHP String strtolower()用法及代碼示例
- PHP String strspn()用法及代碼示例
- PHP String substr_count()用法及代碼示例
- PHP String strtoupper()用法及代碼示例
- PHP String quoted_printable_decode()用法及代碼示例
- PHP String轉Float用法及代碼示例
- PHP String nl_langinfo()用法及代碼示例
- PHP String strtok()用法及代碼示例
- PHP String vprintf()用法及代碼示例
- PHP String substr_replace()用法及代碼示例
- PHP String str_replace()用法及代碼示例
注:本文由純淨天空篩選整理自whmcs.com大神的英文原創作品 StartTaskTimer。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。