Set Interfaces IPv4
If vSphere APIs begin with /rest (vs /api), any maps are consumed/returned instead as arrays of objects, each containing a key and a value property field.
Set IPv4 network configuration for specific network interface.
Request
URLURL
https://{api_host}/rest/appliance/networking/interfaces/{interface_name}/ipv4
Parameters
Parameters
string
interface_name
Required
The Network interface to query, for example, "nic0".
The parameter must be an identifier for the resource type: com.vmware.appliance.networking.interfaces.
Header Parameters
Header Parameters
string
vmware-api-session-id
Required
Required session ID, obtained by first calling Create Session API
Example: b00db39f948d13ea1e59b4d6fce56389
Request Body
Request Body
NetworkingInterfacesIpv4SetRequestBody of type application/json (required){
"config": {
"mode": "enum"
}
}
cURL Command
curl -X PUT -H "vmware-api-session-id: b00db39f948d13ea1e59b4d6fce56389" -H "Content-Type: application/json" -d '{"config":{"address":"string","default_gateway":"string","mode":"enum","prefix":0}}' https://{api_host}/rest/appliance/networking/interfaces/{interface_name}/ipv4
Errors
404
com.vmware.vapi.std.errors.not_found : if the specified NIC is not found. | com.vmware.vapi.std.errors.error : Generic error.
409
com.vmware.vapi.std.errors.not_allowed_in_current_state : if the IP is used as PNID | com.vmware.vapi.std.errors.resource_busy : if the specified NIC is busy.