当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。