當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


PHP WHMCS GetAdminUsers用法及代碼示例

檢索管理員用戶帳戶的列表。

請求參數

參數 類型 說明 必需的
action string “GetAdminUsers” Required
roleid int 要過濾的管理角色 ID。 Optional
email string 要過濾的電子郵件地址。支持部分匹配。 Optional
include_disabled bool 作為 true 傳遞以包含禁用的管理員用戶帳戶作為響應。 Optional

響應參數

參數 類型 說明
result string 操作結果:成功或錯誤
count int 符合提供標準的管理用戶總數。
admin_users 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' => 'GetAdminUsers',
            // 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 = 'GetAdminUsers';
$postData = array(
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later

$results = localAPI($command, $postData, $adminUsername);
print_r($results);

示例響應 JSON

{
    "count": 2,
    "admin_users": [
        {
            "id": 1,
            "uuid": "41dac92c-2f1a-474b-bef8-5e9a7e46e101",
            "roleId": 1,
            "username": "Admin",
            "twoFactorAuthModule": "",
            "firstname": "Demo",
            "lastname": "User",
            "email": "[email protected]",
            "signature": "",
            "notes": "",
            "template": "blend",
            "language": "english",
            "isDisabled": 0,
            "loginAttempts": 0,
            "supportDepartmentIds": [
                "1",
                "2",
                "3"
            ],
            "receivesTicketNotifications": [
                "1",
                "2"
            ],
            "homepageWidgetsConfig": "",
            "hiddenHomepageWidgets": "",
            "created_at": "2018-01-01 00:00:00",
            "updated_at": "2018-09-04 09:51:26",
            "fullName": "Demo User",
            "gravatarHash": "56487cdd284a735449d029e062d654d7"
        },
        {
            "id": 2,
            "uuid": "",
            "roleId": 2,
            "username": "Georgina",
            "twoFactorAuthModule": "",
            "firstname": "Georgina",
            "lastname": "Williams",
            "email": "[email protected]",
            "signature": "",
            "notes": "",
            "template": "blend",
            "language": "english",
            "isDisabled": 0,
            "loginAttempts": 0,
            "supportDepartmentIds": [
                "2",
                "3"
            ],
            "receivesTicketNotifications": [
                ""
            ],
            "homepageWidgetsConfig": "",
            "hiddenHomepageWidgets": "",
            "created_at": "2018-01-01 00:00:00",
            "updated_at": "2018-05-01 12:54:16",
            "fullName": "Georgina Williams",
            "gravatarHash": "f8c28cf89551c390ae43938167d35cb8"
        }
    ]
}

相關用法


注:本文由純淨天空篩選整理自whmcs.com大神的英文原創作品 GetAdminUsers。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。