ErrorResponse
更新时间: 2026/06/29
在Gitcode上查看源码

ResourceDefinition

uris

  • 无固定URI,适用于所有Redfish接口的错误响应

properties

名称类型是否只读取值范围/枚举值说明
errorobjecttrue-错误响应对象
error.codestringtrue-错误码
error.messagestringtrue-错误信息
error.@Message.ExtendedInfoarraytrue-用于承载错误消息的响应内容
error.@Message.ExtendedInfo[].MessageIdstringtrue-消息注册表标识
error.@Message.ExtendedInfo[].RelatedPropertiesarraytrue-报错消息所关联的接口属性
error.@Message.ExtendedInfo[].Messagestringtrue-详细的报错信息
error.@Message.ExtendedInfo[].MessageArgsarraytrue-报错信息包含的动态参数
error.@Message.ExtendedInfo[].Severitystringtrue● OK
● Critical
● Warning
严重级别
error.@Message.ExtendedInfo[].Resolutionstringtrue-错误发生后,可尝试的解决方案

supported_methods

  • GET
  • POST
  • PATCH
  • DELETE

HTTP methods

GET (POST,PATCH,DELETE)

命令功能

接口响应报错机制

说明

一般情况下,响应码为200即表示当前操作执行成功,接口报错都符合以下示例所示的形式。

json
{
  "error": {
    "code": "Base.1.0.GeneralError",
    "message": "A general error has occurred. See ExtendedInfo for more information.",
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_0_0.Message",
        "MessageId": "Base.1.0.ResourceInUse",
        "RelatedProperties": [],
        "Message": "The change to the requested resource failed because the resource is in use or in transition.",
        "MessageArgs": [],
        "Severity": "Warning",
        "Resolution": "Remove the condition and resubmit the request if the operation failed."
      }
    ]
  }
}

使用PATCH方法同时修改多个属性的场景下,redfish接口将认为不同的属性设置是不同的操作,因此,只要有一个属性修改成功,则响应码会返回200, 修改失败的属性将在返回报文中以Message的形式报错给用户,以同时修改用户名和密码为例,示例如下:

请求:

json
{
  "UserName": "Administrator",
  "Password": "Admin@9000"
}

响应:

json
{
  "@odata.context": "/redfish/v1/$metadata#AccountService/Accounts/Members/$entity",
  "@odata.id": "/redfish/v1/AccountService/Accounts/2",
  "@odata.type": "#ManagerAccount.v1_0_2.ManagerAccount",
  "Id": "2",
  "Name": "User Account",
  "Password": null,
  "UserName": "Administrator",
  "RoleId": "Administrator",
  "ReauthKey": "null",
  "Locked": false,
  "Enabled": true,
  "Oem": {
    "Public": {
      "AccountInsecurePromptEnabled": false,
      "FirstLoginPolicy": "PromptPasswordReset",
      "MutualAuthClientCert": null,
      "SSHPublicKeyHash": null,
      "LoginInterface": [
        "Web",
        "SNMP",
        "IPMI",
        "SSH",
        "SFTP",
        "Local",
        "Redfish"
      ],
      "SnmpV3AuthProtocol": "SHA256",
      "SnmpV3PrivPasswd": null,
      "SnmpV3PrivProtocol": "AES",
      "SNMPEncryptPwdInit": false,
      "Deleteable": false,
      "DelDisableReason": "UniqueAdminUser",
      "LoginRule": [],
      "PasswordValidityDays": null,
      "Actions": {
        "#Account.ImportMutualAuthClientCert": {
          "target": "/redfish/v1/AccountService/Accounts/2/Oem/Public/Actions/Account.ImportMutualAuthClientCert",
          "@Redfish.ActionInfo": "/redfish/v1/AccountService/Accounts/2/ImportMutualAuthClientCertActionInfo"
        },
        "#Account.DeleteMutualAuthClientCert": {
          "target": "/redfish/v1/AccountService/Accounts/2/Oem/Public/Actions/Account.DeleteMutualAuthClientCert",
          "@Redfish.ActionInfo": "/redfish/v1/AccountService/Accounts/2/DeleteMutualAuthClientCertActionInfo"
        },
        "#Account.ImportSSHPublicKey": {
          "target": "/redfish/v1/AccountService/Accounts/2/Oem/Public/Actions/Account.ImportSSHPublicKey",
          "@Redfish.ActionInfo": "/redfish/v1/AccountService/Accounts/2/ImportSSHPublicKeyActionInfo"
        },
        "#Account.DeleteSSHPublicKey": {
          "target": "/redfish/v1/AccountService/Accounts/2/Oem/Public/Actions/Account.DeleteSSHPublicKey",
          "@Redfish.ActionInfo": "/redfish/v1/AccountService/Accounts/2/DeleteSSHPublicKeyActionInfo"
        }
      }
    }
  },
  "Links": {
    "Role": {
      "@odata.id": "/redfish/v1/AccountService/Roles/Administrator"
    }
  },
  "@Message.ExtendedInfo": [
    {
      "MessageId": "iBMC.1.0.PasswordInWeakPWDDict",
      "RelatedProperties": [
        "#/Password"
      ],
      "Message": "Password cannot be included in the weak password dictionary.",
      "MessageArgs": [],
      "Severity": "Warning",
      "Resolution": "Try again using a valid value."
    }
  ]
}

如上形式的返回表示用户名已修改成功,用户密码因为弱密码修改失败,错误消息附加在报文中返回。