API Guide

Table Of Contents
print(response)
if(response.status_code == 200):
json_response = json.dumps(response.json(), indent=4, sort_keys=True)
registered_vc_array = json.loads(json_response)
for vc in registered_vc_array:
if vcenter_ip.upper() == vc['ip'].upper():
vcenter_id = vc['id']
if(host_id == None):
url = "https://" + omivvIP + "/Spectre/api/rest/v1/Services/
ConsoleService/Consoles/" + vcenter_id + "/Hosts"
else:
url = "https://" + omivvIP + "/Spectre/api/rest/v1/Services/
ConsoleService/Consoles/" + vcenter_id + "/Hosts/" + host_id
head = {'Authorization': 'Bearer ' + bearerToken}
response = requests.get(url, verify=False, headers=head)
if (response.status_code == 200):
json_response = json.dumps(response.json(), indent=4,
sort_keys=True)
print(json_response)
return json_response
else:
print("Get host details failed")
else:
print("Get registered vCenter list failed")
```
4. Get the repository profile ID.
Repository profile contains the firmware and driver repository information. You can use firmwrae repository to update the
firmware.
To get the list of repository profile, ensure that you have the following vCenter privilege: Dell.Inventory.Configure Inventory.
Sample code to get the repository profile ID:
```json
def get_repo_ID(omivvIP,bearerToken):
url ="https://" + omivvIP + "/Spectre/api/rest/v1/Services/PluginProfileService/
RepositoryProfiles"
head = {'Authorization': 'Bearer ' + bearerToken}
jsonReponse = requests.get(url, verify=False, headers=head)
if(jsonReponse.status_code == 200):
return jsonReponse.json()
else:
print("Get getallRepositoryProfile failed")
pass
```
5. Get the firmware repository inventory details. From step 3 and 4, we have received the system ID and repository profile ID of
the inventory details.
Firmware repository inventory contains the bundle ID and firmware component details. Ensure that you have the following
vCenter privilege to get the firmware repository inventory details: Dell.Configuration.Firmware Update
Sample code to get the firmware repository inventory:
```json
def postFirmwareInventoryReportforHost(omivvIP, bearerToken, systemID, bundleID,
repoID, hostID='',clusterID=''):
url = "https://" + omivvIP + "/Spectre/api/rest/v1/Services/UpdateService/
FWReport"
head = {'Authorization': 'Bearer ' + bearerToken}
if(hostID != ''):
postBodyData = {"reportType": "HOST", "hostID": hostID, "repoProfileID":
repoID, "bundleAssociation" : [{"systemId": systemID, "bundleID": bundleID}]}
else:
postBodyData = {"reportType": "HOST", "clusterID": clusterID,
"repoProfileID": repoID, "bundleAssociation": [{"systemId": systemID, "bundleID":
bundleID}]}
jsonReponse = requests.post(url, json=postBodyData, verify=False,headers=head)
if(jsonReponse.status_code == 200):
return jsonReponse.json()
26
Use cases