代码仓
中
Expand
更新时间: 2026/10/27
在AtomGit上查看源码

ResourceDefinition ​

uris ​

  • https://device_ip/redfish/v1/Chassis?$expand=.($levels=levels_num)

properties ​

名称类型是否只读取值范围/枚举值说明
@odata.contextstringtrue-资源模型的OData描述信息
@odata.idstringtrue-资源节点的访问路径
@odata.typestringtrue-资源类型
Namestringtrue-资源名称
Members@odata.countnumbertrue-集合资源成员总数
Members [ {arraytrue-展开超链接后的资源成员列表
Members[].@odata.contextstringtrue-展开后资源的元数据描述信息
Members[].@odata.idstringtrue-展开后资源的访问路径
Members[].@odata.typestringtrue-展开后资源的类型
Members[].Idstringtrue-展开后资源的唯一标识
Members[].Namestringtrue-展开后资源的名称
Members[].Oem{}objecttrue-展开后资源的自定义属性
} ]
Members@odata.nextLinkstringtrue-下一页的链接

supported_methods ​

  • GET

HTTP methods ​

GET ​

命令功能

扩展超链接显示($expand)

说明

本命令适用于包含超链接的资源的查询操作,当GET操作的回显信息中包含特殊要求的超链接资源时,可以展开这种超链接,即将超链接指向的资源信息包含在本次请求中。"$expand"参数可以在不知道资源的链接时,减少请求次数。可以展开的特殊超链接必须满足以下条件: ● 某个属性值为JSON对象,且这种JSON对象仅包含一个属性名称为"@odata_id",属性值为有效的超链接; ● 某个属性值为JSON对象类型的集合,且这种JSON对象仅包含一个属性名称为"@odata_id",属性值为有效的超链接; 当前仅支持扩展一层超链接,即不扩展超链接展开信息中的下一层超链接。此外,"$expand"参数可以与上节的"$skip"、"$top"参数混合使用。

命令格式

URL: https://device_ip/redfish/v1/Chassis?$expand=.($levels=levels_num) 或 URL: https://device_ip/redfish/v1/Chassis/?$top=top_num&$skip=skip_num&$expand=.($levels=levels_num)

请求头:

cmd
X-Auth-Token: 123456789***********************

请求消息体: 无

参数说明

参数参数说明取值
device_ip登录设备的IP地址IPv4或IPv6地址
levels_num展开超链接的递归层数当前仅支持数值为1
auth_value执行该GET请求时,必须在"Headers"中携带"X-Auth-Token"值用于鉴权可通过/redfish/v1/SessionService/Sessions创建会话时获得

使用指南

集合资源的回显受分页限制,与"$skip"和"$top"参数一致。

使用实例

不带"$expand"参数查询SessionService资源的请求样例:

http
GET <https://device_ip/redfish/v1/SessionService>

请求头:

cmd
X-Auth-Token: 123456789***********************

请求消息体:无

响应样例:

json
{
"@odata.context": "/redfish/v1/$metadata#SessionService",
"@odata.id": "/redfish/v1/SessionService",
"@odata.type": "#SessionService.v1_0_2.SessionService",
"Id": "SessionService",
"Name": "Session Service",
"SessionTimeout": 300,
"Sessions": {
"@odata.id": "/redfish/v1/SessionService/Sessions"
},
"Oem": {
"Public": {
"WebSessionTimeoutMinutes": 5,
"WebSessionMode": "Private"
}
}
}

响应码:200

使用"$expand"参数查询SessionService资源的请求样例:

http
GET <https://device_ip/redfish/v1/SessionService?$expand=.($levels=1)>

请求头:

cmd
X-Auth-Token: 123456789***********************

请求消息体:无

响应样例:

json
{
"@odata.context": "/redfish/v1/$metadata#SessionService",
"@odata.id": "/redfish/v1/SessionService",
"@odata.type": "#SessionService.v1_0_2.SessionService",
"Id": "SessionService",
"Name": "Session Service",
"SessionTimeout": 300,
"Sessions": {
"@odata.context": "/redfish/v1/$metadata#SessionService/Sessions/$entity",
"@odata.id": "/redfish/v1/SessionService/Sessions",
"@odata.type": "#SessionCollection.SessionCollection",
"Name": "Session Collection",
"Members@odata.count": 0,
"Members": []
},
"Oem": {
"Public": {
"WebSessionTimeoutMinutes": 5,
"WebSessionMode": "Private"
}
}
}

响应码:200

不使用"$expand"参数查询集合类资源的请求样例:

http
GET <https://device_ip/redfish/v1/Chassis?$skip=2&$top=3>

请求头:

cmd
X-Auth-Token: 123456789***********************

请求消息体:无

响应样例:

json
{
"@odata.context": "/redfish/v1/$metadata#Chassis",
"@odata.id": "/redfish/v1/Chassis",
"@odata.type": "#ChassisCollection.ChassisCollection",
"Name": "Chassis Collection",
"Members@odata.count": 43,
"Members": [
{
"@odata.id": "/redfish/v1/Chassis/U41"
},
{
"@odata.id": "/redfish/v1/Chassis/U40"
}
],
"Members@odata.nextLink": "/redfish/v1/Chassis?$skip=4&$top=32"
}

响应码:200

使用"$expand"参数查询集合类资源的请求样例:

http
GET <https://device_ip/redfish/v1/Chassis?$skip=2&$top=2&$expand=.($levels=1)>

请求头:

cmd
X-Auth-Token: 123456789***********************

请求消息体:无

响应样例:

json
{
"@odata.context": "/redfish/v1/$metadata#Chassis",
"@odata.id": "/redfish/v1/Chassis",
"@odata.type": "#ChassisCollection.ChassisCollection",
"Name": "Chassis Collection",
"Members@odata.count": 43,
"Members": [
{
"@odata.context": "/redfish/v1/$metadata#Chassis/Members/$entity",
"@odata.id": "/redfish/v1/Chassis/U41",
"@odata.type": "#Chassis.v1_7_0.Chassis",
"Id": "U41",
"Name": "Chassis Asset Info",
"ChassisType": null,
"Manufacturer": null,
"Model": null,
"SerialNumber": null,
"PartNumber": null,
"WeightKg": null,
"IndicatorLED": "Off",
"Status": {
"State": "Absent",
"Health": "OK"
},
"Oem": {
"Public": {
"TopUSlot": 41,
"IndicatorColor": null,
"DiscoveredTime": null,
"UHeight": null,
"DeviceType": null,
"RatedPowerWatts": null,
"CheckInTime": null,
"AssetOwner": null,
"LifeCycleYear": null,
"RFIDTagUID": null,
"ExtendField": null,
"Actions": {
"#Chassis.ControlIndicatorLED": {
"target": "/redfish/v1/Chassis/U41/Oem/Public/Actions/Chassis.ControlIndicatorLED",
"@Redfish.ActionInfo": "/redfish/v1/Chassis/U41/ControlIndicatorLEDActionInfo"
}
}
}
},
"Links": {
"ContainedBy": {
"@odata.id": "/redfish/v1/Chassis/Rack"
}
}
},
{
"@odata.context": "/redfish/v1/$metadata#Chassis/Members/$entity",
"@odata.id": "/redfish/v1/Chassis/U40",
"@odata.type": "#Chassis.v1_7_0.Chassis",
"Id": "U40",
"Name": "Chassis Asset Info",
"ChassisType": null,
"Manufacturer": null,
"Model": null,
"SerialNumber": null,
"PartNumber": null,
"WeightKg": null,
"IndicatorLED": "Off",
"Status": {
"State": "Absent",
"Health": "OK"
},
"Oem": {
"Public": {
"TopUSlot": 40,
"IndicatorColor": null,
"DiscoveredTime": null,
"UHeight": null,
"DeviceType": null,
"RatedPowerWatts": null,
"CheckInTime": null,
"AssetOwner": null,
"LifeCycleYear": null,
"RFIDTagUID": null,
"ExtendField": null,
"Actions": {
"#Chassis.ControlIndicatorLED": {
"target": "/redfish/v1/Chassis/U40/Oem/Public/Actions/Chassis.ControlIndicatorLED",
"@Redfish.ActionInfo": "/redfish/v1/Chassis/U40/ControlIndicatorLEDActionInfo"
}
}
}
},
"Links": {
"ContainedBy": {
"@odata.id": "/redfish/v1/Chassis/Rack"
}
}
}
],
"Members@odata.nextLink": "/redfish/v1/Chassis?$skip=4&$top=32"
}

响应码:200