POST – 创建帐户
通过 HTTP POST 方法为 Redfish 服务创建帐户资源。
请求 URL
POST https://<BMC_IPADDR>/redfish/v1/AccountService/Accounts
请求正文
字段  | 类型  | 描述  | |
|---|---|---|---|
UserName  | 字符串  | 新帐户名称。  | |
Enabled  | 布尔  | 指示是否启用此帐户。  | |
Password  | 字符串  | 新帐户密码。  | |
RoleId  | 字符串  | 新帐户的角色 ID。  | |
PasswordChangeRequired  | 布尔  | 首次登录时是否需要更改密码。  | |
AccountTypes  | 数组  | 允许新帐户访问的各种管理器服务。  | |
AccountTypes[N]  | 字符串  | “Redfish”、“SNMP”、“ManagerConsole”、“IPMI”、“WebUI” 注 如果帐户具有 IPMI 访问权限,则应将密码设置为等于或少于 20 个字符。如果帐户具有 SNMP 访问权限,则应将 EncryptionKey 设置为等于或少于 32 个字符。此外,如果 EncryptionProtocol 不是“none”,则 AuthenticationProtocol 也不应该是“none”。  | |
SNMP  | 对象  | 展开 注 当 AccountTypes 不包含“SNMP”时,此设置不可用。  | |
AuthenticationProtocol  | 字符串  | 此值指示认证符合认证协议。  | |
EncryptionKey  | 字符串  | SNMPv3 的机密认证密钥。  | |
EncryptionProtocol  | 字符串  | 此值指示加密符合加密协议。  | |
响应正文
响应返回的内容与 GET 操作相同,但更新了属性。
状态代码
| HTTP 状态代码 | 错误消息 ID | 
|---|---|
| 500 | InternalError | 
| 400 | CreateFailedMissingReqProperties PropertyValueTypeError PropertyValueFormatError ResourceChangeRequried NotRecommandedOperation ForbiddenOperation ResourceAlreadyExists PropertyMissing PasswordChangeRequired  | 
示例
以下示例是 POST 正文
{
    "UserName": "TempUser",
    "Password": "Passw0rd4U",
    "RoleId": "Administrator",
    "PasswordChangeRequired": true,
    "AccountTypes": [
        "WebUI",
        "Redfish",
        "SNMP",
        "ManagerConsole"
    ],
    "SNMP": {
        "AuthenticationProtocol": "HMAC_SHA96",
        "EncryptionKey": "snmpPassw0rd",
        "EncryptionProtocol": "CFB128_AES128"
    }
}
返回以下示例 JSON 响应:
{
    "HostBootstrapAccount": false,
    "AccountTypes@Redfish.AllowableValues": [
        "WebUI",
        "Redfish",
        "ManagerConsole",
        "IPMI",
        "SNMP"
    ],
    "@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount",
    "UserName": "TempUser",
    "Locked": false,
    "RoleId": "Administrator",
    "Name": "User2",
    "PasswordChangeRequired": true,
    "Password": null,
    "@odata.etag": "\"0000000000000000000000000000000032a05d16\"",
    "Oem": {
        …
    },
    "Enabled": true,
    "SNMP": {
        "EncryptionProtocol": "CFB128_AES128",
        "AuthenticationProtocol": "HMAC_SHA96",
        "EncryptionKey": null,
        "EncryptionKeySet": true
    },
    "@odata.id": "/redfish/v1/AccountService/Accounts/2",
    "AccountTypes": [
        "WebUI",
        "Redfish",
        "ManagerConsole",
        "SNMP"
    ],
    "Links": {
        "Role": {
            "@odata.id": "/redfish/v1/AccountService/Roles/Administrator"
        }
    },
    "Id": "2",
    "Description": "This resource is used to represent an account for the manager for a Redfish implementation.",
    "@odata.type": "#ManagerAccount.v1_8_1.ManagerAccount",
    "PasswordExpiration": "2022-08-12T05:56:08Z"
}