White Papers
16 Dell OpenManage Power Center 4.0 REST API Reference Guide
Sample Request:
3.5 Usage
The usual usage of using Report REST API is listed below:
1. Call getSystemReportTypeSummary to get template of a specified report type;
2. Add & run a report:
In request header:
set authentication header;
In request body:
specify the the attribute list in request body referring to the result of
getSystemReportTypeSummary, leave attributes field empty to use default attributes’ setting;
specify time range (start / end);
specify aggregation type and value (if aggregation period allowed);
specify specific fields (severity, percentPower) for related report types;
Send the request and get checkStatus link / report id from the response;
3. Call checkStatus with report id to Check report status till it becomes “Completed” or “Error”, fetch the
“getReportResult” link;
4. Call getReportResult with report id to get the report result, specify proper page index and row count
per page to present the result in pages;
5. In case of error response, try to locate the root cause with the error message / code returned and
retry after adjusting input;
3.6 Report status
CheckStatus will return the status of specific report. The possible report status are:
Running
Deleted
Pending
Erroneous
Completed
# developed using Python 3.5
import base64
import json
import ssl
import urllib.request
from pprint import pprint
bseurl = 'https://localhost:8643/powercenter/api/report/getSystemReportTypeSummary?reportType=powerHoarders'
encoded_auth = base64.b64encode(b'user:pwd:0', None)
if __name__ == "__main__":
req = urllib.request.Request(bseurl)
req.add_header('Authorization', encoded_auth)
req.add_header('Content-Type', 'application/json')
data = ""
try:
cntx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
with urllib.request.urlopen(req, context=cntx) as f:
data = json.loads(f.read().decode('utf-8'))
except Exception as e:
print('Error:', str(e))
quit()
pprint(data)
quit()