Creating a Session
Function
This interface is used to create a session.
Syntax
Operation type: POST
URL: https://device_ip/redfish/v1/SessionService/Sessions
Request header:
Content-Type: header_type
Request message body:
{
"UserName":name,
"Password":password
}
Parameters
Parameter |
Description |
Value |
---|---|---|
device_ip |
IP address for logging in to a device |
An IPv4 or IPv6 address |
header_type |
Request format |
Supported formats include:
|
name |
User name of the new session |
Atlas IES user |
password |
Password of the new session |
Password of the Atlas IES user |
Usage Guidelines
During the Redfish operations, the POST operation must be performed first. The X-Auth-Token value, which is carried in Headers for authentication in other operations, is obtained through the POST operation.
Example
Request:
POST https://10.10.10.10/redfish/v1/SessionService/Sessions
Request header:
Content-Type: application/json
Request message body:
{
"UserName": "username",
"Password": "password"
}
Response:
{
"@odata.context": "/redfish/v1/$metadata#Session.Session",
"@odata.id": "/redfish/v1/SessionService/Sessions/32183f508915e2869bce2759d679af69ebd44621452e8bda",
"@odata.type": "#Session.v1_0_2.Session",
"Id": "32183f508915e2869bce2759d679af69ebd44621452e8bda",
"Name": "User Session",
"Oem": {"Huawei": {"UserAccount": "admin", "LoginTime": "2019-07-09 19:35:48", "UserIP": "127.0.0.1", "UserTag": "Redfish", "MySession": true}}
}
Response code: 201
Output Description
Attribute |
Type |
Description |
---|---|---|
@odata.context |
Character string |
Access path of a session resource model |
@odata.id |
Character string |
Access path of a session resource node |
@odata.type |
Character string |
Type of a session resource |
Id |
Character string |
ID of a session resource |
Name |
Character string |
Name of a session |
Oem |
Object |
Customized parameter |
UserAccount |
Character string |
User of a session |
LoginTime |
Character string |
Time when a session is created |
UserIP |
Character string |
User IP address of a session |
UserTag |
Character string |
Login port of a session
|
MySession |
Boolean value |
Indicates whether a session is created by the current user. The value is true. |