This post is more than 5 years old
1 Rookie
•
8 Posts
0
3880
May 29th, 2018 01:00
Idrac RedFish Session Auth
Hello,
There is a python example how to use RedFish Session Management Authen (& not the basic one) ?
I use this code :
url = 'https://%s/redfish/v1/Sessions' %(login_host)
req = requests.post(url, data=json.dumps(payload), headers=headers,verify=False)
status_code = req.status_code
data = req.json()
The result is :
>>> status_code
201
>>> data
{'@Message.ExtendedInfo': [{'Message': 'The resource has been created successfully', 'MessageArgs': [], 'MessageArgs@odata.count': 0, 'MessageId': 'Base.1.0.Created', 'RelatedProperties': [], 'RelatedProperties@odata.count': 0, 'Resolution': 'None', 'Severity': 'OK'}, {'Message': 'A new resource is successfully created.', 'MessageArgs': [], 'MessageArgs@odata.count': 0, 'MessageId': 'iDRAC.1.5.SYS414', 'RelatedProperties': [], 'RelatedProperties@odata.count': 0, 'Resolution': 'No response action is required.', 'Severity': 'Informational'}], '@odata.context': '/redfish/v1/$metadata#Session.Session', '@odata.id': '/redfish/v1/Sessions/18', '@odata.type': '#Session.v1_0_2.Session', 'Description': 'User Session', 'Id': '18', 'Name': 'User Session', 'Password': None, 'UserName': 'Admin'}
But i dont know where to get the X-Auth key to put in header for others requests.
In this example, it's an iDrac8 with FW 2.52.52
Thanks.
0 events found


DELL-Shine K
4 Operator
•
3K Posts
1
May 29th, 2018 02:00
X-Auth token will he part of response header not in response body. You can run below command to get the X-Auth token
req.headers.get("x-auth-token")