White Papers

17 Implementation of the DMTF Redfish API on Dell EMC PowerEdge Servers
curl -X POST k https://<iDRAC IP>/redfish/v1/Sessions H “Content-
Type:application/json” -d '{"UserName":"root","Password":"calvin"}' v
Note: when using this command in the Windows command shell, backslashes (\’) must be used to ensure
proper handling of the quote marks for example:
curl -X POST k https://<iDRAC IP>/redfish/v1/Sessions H “Content-
Type:application/json” -d '{\"UserName\":\"root\",\"Password\":\"calvin\"}' v
Once logged in, subsequent commands can be sent using X-Auth-Token as shown below:
curl -k https://<iDRAC IP>/redfish/v1/Chassis -v --header "X-Auth-Token: <X-Auth-Value>"
curl -k https://<iDRAC IP>/redfish/v1/Systems -v --header "X-Auth-Token: <X-Auth-Value>"
After executing the desired commands, the session can be terminated using Logout:
curl -k -X DELETE https://<iDRAC IP>/redfish/v1/Sessions/6 -v --header "X-Auth-Token: <X-Auth-Value>"
3.3 Accessing Redfish by using Python scripting
One of the goals of the Redfish API is to enable easy access from common scripting languages such as
Python. The following Python script examples implement key Redfish API use cases. In these examples, it is
assumed that the Python HTTP “requests” library (found here: http://docs.python-requests.org/en/master/ )
has been downloaded. Also, note that the examples assume the credentials of “root”/“calvin” for access to the
Redfish API these should be changed to the appropriate credentials for a specific iDRAC target.
These Python examples as well as example PowerShell cmdlets are available as open source on the Dell
EMC GitHub: https://github.com/dell/iDRAC-Redfish-Scripting.
Note: when using the examples within a Python script, the warning messages echoed by Redfish requests
commands can be suppressed by adding “import warnings” and “warnings.filterwarnings("ignore")” to the
script.
3.3.1 View general system information and status
In this use case, the SSL/TLS certificate check is skipped by setting “verify=False”. Note that the
“RAID.Integrated.1-1” path may differ between systems depending on the type of RAID controller installed.
Therefore, it is recommended to navigate the API path starting from the root.
import requests
import json
system = requests.get('https://<iDRAC
IP>/redfish/v1/Systems/System.Embedded.1',verify=False,auth=('root','calvin'))
storage = requests.get('https://<iDRAC
IP>/redfish/v1/Systems/System.Embedded.1/Storage/Controllers/RAID.Integrated.1-
1',verify=False,auth=('root','calvin'))