VMware Networking Community
ehodges1
Contributor
Contributor

NSX-ALB API error

I'm trying to use the NSX-ALB (formerly AVI) API to create a Virtual Service using an existing Pool. I am using API version 20.1.1. Here is the JSON payload:

{
"vip": [
{
"ip_address": {
"addr": "10.139.17.28",
"type": "V4"
}
}
],
"name": "EricHoVS5",
"services": [
{
"port": 80
}
],
"pool_ref": {
"name": "EricHoTest4"
}
}

The error I get back is: "VsVip field (vip) found in VirtualService API"

Any help would be appreciated.

Thanks,
Eric

0 Kudos
1 Reply
p0wertje
Hot Shot
Hot Shot

Hi,

Yes. There are 2 entries to create a vip.
1. the vsvip 
2. the virtual service.

The API is telling you that you want to create a vsvip on the virtual service api.

This should go to /api/vsvip

"vip": [
        {
            "vip_id": "1",
            "ip_address": {
                "addr": "x.x.x.x",
                "type": "V4"
            },
            "enabled": true,
            "auto_allocate_ip": true,
            "auto_allocate_floating_ip": true,
            "avi_allocated_vip": true,
            "avi_allocated_fip": true,
            "auto_allocate_ip_type": "V4_ONLY",
            "prefix_length": 32
        }
    ],
 
and then to /api/virtualservice
*snip*
"services": [
{
"port": 443,
"enable_ssl": false,
"port_range_end": 443,
"enable_http2": false
},
{
"port": 80,
"enable_ssl": false,
"port_range_end": 80,
"enable_http2": false
}
],
 
The 'easiest' is to create a complete VIP in gui and then query it on API. You can see all the fields.
 
Cheers,
p0wertje | VCIX6-NV | JNCIS-ENT | vExpert
Please kudo helpful posts and mark the thread as solved if solved
0 Kudos