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
}
Request Parameters
Parameter |
Mandatory/Optional |
Description |
Value |
|---|---|---|---|
UserName |
Mandatory |
User name of a new session. |
The value is a string of 1 to 16 characters, which can contain digits and letters but cannot contain only digits. |
Password |
Mandatory |
Password of a new session. |
Password of the edge management system user. The value is a string of 8 to 20 characters. |
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/49fec170a501116ec8e10c8dd279fe51218a3a805ee37173",
"@odata.type": "#Session.v1_4_0.Session",
"Id": "49fec170a501116ec8e10c8dd279fe51218a3a805ee37173",
"Name": "User Session",
"UserName": "admin",
"Oem": {
"UserId": 1,
"AccountInsecurePrompt": false,
"message": "[1:admin]"
}
}
Response code: 201
Output Description
Field |
Type |
Description |
|---|---|---|
@odata.context |
Character string |
OData description of the new session resource model. |
@odata.id |
Character string |
Path to access the new session resource node. |
@odata.type |
Character string |
Type of the new session resource. |
Id |
Character string |
ID of the new session resource. |
Name |
Character string |
Name of the new session. |
UserName |
Character string |
User of a session. |
Oem |
Object |
Custom attribute. |
UserId |
Number |
User ID of the current session. |
AccountInsecurePrompt |
Boolean |
Insecure password prompt.
|
message |
Character string |
Content including session user and ID. |