White Papers

11 RESTful Server Configuration with iDRAC RESTful API
Script redfish_SCP_export_cifs.v1.py: Version 1
#
# Version 1 - Python iDRAC RESTful API script to export
# server configuration profile
#
import requests, json
url = 'https://192.168.0.120/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Oem/EI
D_674_Manager.ExportSystemConfiguration'
payload = {"ExportFormat":"XML","ShareParameters":{"Target":"ALL","IPAddress":"1
92.168.0.130","ShareName":"cifs_share","ShareType":"CIFS","UserName":"user","Pas
sword":"password","FileName":"R740xd_SCP.xml"}}
headers = {'content-type': 'application/json'}
response = requests.post(url, data=json.dumps(payload), headers=headers, verify=
False, auth=('username','password'))
print '- Response status code is: %s' % response.status_code
response_output=response.__dict__
print response_output
2.2 Executing iDRAC RESTful API SCP export script
We will now execute the SCP export Python script and parse the data returned. The key information needed
from the output are the “status code” returned by the export request and the “Job ID” – when an SCP export is
requested, the iDRAC will create an asynchronous job to gather all of the requested settings from the server
components, assemble the results into a file, and write the file to the target network share. The job will be
monitored to determine its successful completion.
$ python ./redfish_SCP_export_cifs.v1.py
- Response status code is: 202
{'cookies': <<class 'requests.cookies.RequestsCookieJar'>[]>, '_content': '',
'headers': {'Content-Length': '0', 'Keep-Alive': 'timeout=60, max=100',
'Server': 'Apache/2.4', 'Connection': 'Keep-Alive', 'Location':
'/redfish/v1/TaskService/Tasks/JID_967978014801', 'Cache-Control': 'no-cache',
'Date': 'Wed, 07 Jun 2017 01:10:01 GMT', 'OData-Version': '4.0', 'Access-
Control-Allow-Origin': '*', 'Content-Type':
'application/json;odata.metadata=minimal;charset=utf-8', 'X-Frame-Options':
'DENY'}, 'url':
u'https://192.168.0.120/redfish/v1/Managers/iDRAC.Embedded.1/Actions/Oem/EID_674
_Manager.ExportSystemConfiguration', 'status_code': 202, '_content_consumed':
True, 'encoding': 'utf-8', 'request': <PreparedRequest [POST]>, 'connection':
<requests.adapters.HTTPAdapter object at 0x7ffa89d5f290>, 'elapsed':
datetime.timedelta(0, 1, 102737), 'raw':
<requests.packages.urllib3.response.HTTPResponse object at 0x7ffa89d8f290>,
'reason': 'Accepted', 'history': []}
$
A status code return of “202” indicates the SCP export request was successful. For more information on
possible returned status code values, consult the Dell Redfish API Reference Guide.