API Guide

Table Of Contents
help="Id of the host")
PARSER.add_argument("--getdetails", "-getd", required=True,
help="get details of the host. Accepted value: 1.SubSystemHealth
2.HostOverview, 3.FirmwareInventory, 4.Warranty")
ARGS = PARSER.parse_args()
if(ARGS.password == None and ARGS.bearertoken == None):
print("Pass either the password or the bearer token")
get_vcenter_tree(ARGS.ip, ARGS.user, ARGS.password, ARGS.bearertoken,
ARGS.vcenterip, ARGS.vcusername, ARGS.vcdomain, ARGS.vcpassword, ARGS.hostId,
ARGS.getdetails)
```
Retrieve firmware repository data
Prerequisites
Ensure that you have verified all the pre-requisites mentioned in the Prerequisites on page 9.
About this task
Software components needs to be identified from a desired firmware repository before updating the firmware associated to
those components on a cluster or an individual host.
This topic describes various steps to retrieve the software components details of a host.
Steps
1. Start an OMIVV session using OMIVV user credentials. OMIVV credentials are required to authenticate a client of the
RESTful API.
For more information, see OMIVV authentication on page 11.
Sample code to start an OMIVV session:
```json
def login_with_OMIVV (omivvIP,username,domain, password):
baseurl ="https://" + omivvIP + "/Spectre/api/rest/v1/Services/
AuthenticationService/login"
postBodyData={"apiUserCredential" : {"username":username,"domain" :
domain,"password" : password}}
jsonReponse = requests.post(baseurl, json=postBodyData, verify=False)
if(jsonReponse.status_code == 200):
bearerToken = jsonReponse['accessToken']
return bearerToken
else:
print("Login failed")
```
2. Set the vCenter context. After you log in to OMIVV, select or identify a vCenter on which you want to perform operation.
This is done by setting an operational context.
For more information, see OMIVV authentication on page 11.
Before setting the vCenter Context, get the list of registered vCenters.
Sample code to get the list of registered vCenters:
```json
def getRegisteredVcenterList(omivvIP,bearerToken):
url ="https://" + omivvIP + "/Spectre/api/rest/v1/Services/ConsoleService/
Consoles"
head = {'Authorization': 'Bearer ' + bearerToken}
jsonReponse = requests.get(url, verify=False, headers=head)
if(jsonReponse.status_code == 200):
return Response
else:
24
Use cases