White Papers

10 RESTful Server Configuration with iDRAC RESTful API
2.1 Preparing to use SCP ExportSystemConfiguration method
This section provides details about the creation of Python scripts for exporting a system configuration to a
CIFS share by using a RESTful POST command. Before creating the Python script, two specific Python
modules are needed: requests and json. If your version of Python does not have these modules installed,
use “make-install” to install them.
To begin the script, compile the URL for the POST command. From Appendix 2, view the JSON output for
URL “https://<iDRAC IP>/redfish/v1/Managers/iDRAC.Embedded.1”, look within the OEM
ExportSystemConfiguration method and find “Target”. This URL is assigned to the variable “url” for the
POST command. For example:
url =
https://<iDRACIP>/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Oem/EID_674_Manager.Export
SystemConfiguration
Create a header that acts as a dictionary that specifies that the content type of the POST operation will be
JSON:
headers = {'content-type': 'application/json'}
Next, compile a payload dictionary for the parameters that will be provided for the
ExportSystemConfiguration method. ShareParameters must be a nested dictionary within a dictionary; this
nesting is visible within the JSON output in Appendix 2:
payload =
{"ExportFormat":"XML","ShareParameters":{"Target":"ALL","IPAddress":"192.168.0.1
30","ShareName":"cifs_share","ShareType":"CIFS","UserName":"<cifs
username>","Password":"<cifs password>","FileName":"R740xd_SCP.xml"}}
This payload indicates that:
The SCP will be exported in XML format
All possible server configuration componentsBIOS, iDRAC, PERC, NIC, and HBAwill be exported
Specifies the address of the source server iDRAC
Provides the CIFS share pathname, file name, and credentials to access the CIFS share
Compile the POST command by passing in the URL, payload, and header. Assign this command to a variable
which will be used to parse the data, check the status code, and get the job ID for the SCP export job. This
script uses Basic Authentication and passes the required iDRAC administrator credentials:
response = requests.post(url, data=json.dumps(payload), headers=headers,
verify=False, auth=(‘username’,’password’))
Using the above, here is an example Python script to export the SCP file to a CIFS share: