API Guide
Table Of Contents
- OpenManage Integration for VMware vCenter Version 5.3 API Guide
- Contents
- Overview
- Get started
- Security
- Use cases
- Session management
- License management
- Console management
- Repository profile management
- Cluster profile management
- Firmware repository inventory management
- Firmware inventory management
- Firmware update management
- System profile management
- Drift management
- Get subsystem health report (OMIVV Host Health)
- Host management
- Request body
- Response body
- OMIVV-Specific error codes
registered_vc_array = json.loads(json_response)
for vc in registered_vc_array:
if vcenter_ip.upper() == vc['ip'].upper():
vcenter_id = vc['id']
url = "https://" + OMIVV_ip + "/Spectre/api/rest/v1/Services/
ConsoleService/Consoles/" + vcenter_id + "/Hosts"
head = {'Authorization': 'Bearer ' + session_token}
response = requests.get(url, verify=False, headers=head)
if (response.status_code == 200):
allHost = response.json()
for host in allHost:
if (host["serviceTag"] == host_service_Tag):
url = "https://" + OMIVV_ip + "/Spectre/api/rest/v1/
Services/ConsoleService/Consoles/" + vcenter_id + "/Hosts/" + host['id']
head = {'Authorization': 'Bearer ' + session_token}
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
4. Get bundle ID. Get the bundle ID using the repository profile ID received from step 2 and System ID received from step 3.
Sample code to get the bundle ID:
```json
def getBundleId(omivvIP, bearerToken, repoProfileID, systemId):
url = "https://" + omivvIP + "/Spectre/api/rest/v1/Services/
RepositoryManagementService/RepositoryData?repoProfileID=" + repoProfileID +
"&systemId=" + systemId
head = {'Authorization': 'Bearer ' + bearerToken}
jsonReponse = requests.get(url, verify=False, headers=head)
if (jsonReponse.status_code == 200):
json_object = json.dumps(jsonReponse.json(), indent=4, sort_keys=True)
print(json_object)
else:
print("getRepositoryDataReport API is failed.")
```
5. Create firmware inventory report. You can create the firmware inventory report using the repository profile ID, System ID,
Host ID, and Bundle ID.
Sample code to create the firmware inventory report:
```json
def postFirmwareInventoryReportforHost(omivvIP, bearerToken, systemID, bundleID,
repoID, hostID):
url = "https://" + omivvIP + "/Spectre/api/rest/v1/Services/UpdateService/
FWReport"
head = {'Authorization': 'Bearer ' + bearerToken}
postBodyData = {"reportType": "HOST", "hostID": hostID, "repoProfileID": repoID,
"bundleAssociation" : [{"systemId": systemID, "bundleID": bundleID}]}
jsonReponse = requests.post(url, json=postBodyData, verify=False,headers=head)
if(jsonReponse.status_code == 200):
json_object = json.dumps(jsonReponse.json(), indent=4, sort_keys=True)
print(json_object)
else:
print("PostFirmwareInventoryReport API is failed.")
```
6. Create firmware update job
In this topic, the firmware components that are having Criticality as Urgent and Upgrade Action as Update used in
firmware inventory report.
Once you get all the firmware target details such as repository profile ID, Host ID, Bundle ID, and Package ID, create the
firmware update job
When you are creating firmware update job, enter the following job specific custom configuration details:
28
Use cases