VMware {code} Community
dineshbharti
Contributor
Contributor

Is there a REST api available to get ESXI host IP details or vmkernel adapter ip details?

Looking for a REST api to fetch the esxi host ips or vmkernel adapter ip details. I went through the https://developer.vmware.com/apis/vsphere-automation/ to find out but could not able to.

 

alternative to this - https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.networking.doc/GUID-79846459-2437-4...

 

I did found this article on power cli https://www.vmadmin.co.uk/resources/48-vspherepowercli/251-powerclinetworkoutputcsv

 

but i need rest api only.

 

thank you for the help in advance!

0 Kudos
5 Replies
ConstantinGhioc
Enthusiast
Enthusiast

Check this call: https://{api_host}/api/esx/settings/hosts/{host}/configuration?action=extract

Documentation: https://developer.vmware.com/apis/vsphere-automation/latest/esx/api/esx/settings/hosts/host/configura...

Constantin
0 Kudos
dineshbharti
Contributor
Contributor

Thanks. but this api does not work. I am getting following error.

curl -s -k -XPOST -H "vmware-api-session-id: *******" https://*******/api/esx/settings/hosts/host-1016/configuration?action=extract | jq .
{
"error_type": "NOT_FOUND",
"messages": [
{
"args": [],
"default_message": "Not found.",
"id": "com.vmware.vapi.rest.httpNotFound"
}
]
}

Initially i thought i am using it wrong, but then i called another api to list the host which is successful.

curl -s -k -XGET -H "vmware-api-session-id: *******" https://*******/api/vcenter/host | jq .
[
{
"host": "host-1010",
"name": "esxi-11.*******",
"connection_state": "CONNECTED",
"power_state": "POWERED_ON"
},
{
"host": "host-1016",
"name": "esxi-10.*******",
"connection_state": "CONNECTED",
"power_state": "POWERED_ON"
},
{
"host": "host-1017",
"name": "esxi-13.*******",
"connection_state": "CONNECTED",
"power_state": "POWERED_ON"
},
{
"host": "host-1018",
"name": "esxi-14.*******",
"connection_state": "CONNECTED",
"power_state": "POWERED_ON"
}
]

I also saw the thread with same error - https://communities.vmware.com/t5/VMware-vCenter-Discussions/Getting-quot-com-vmware-vapi-rest-httpN...

but it did not help

0 Kudos
dineshbharti
Contributor
Contributor

Note: I tried it with IP and FQDN both but same issue

0 Kudos
dineshbharti
Contributor
Contributor

We are using version 7.0u2

0 Kudos
dineshbharti
Contributor
Contributor

My bad. It seems that the given API is not available/supported in 7.0u2.

It seems to be available only for v8.0.0 and latest

0 Kudos