Forum Discussion

James_Thomson's avatar
Jul 08, 2014

iControl REST curl command to create VLAN

If you have a CURL command to create a VLAN using iControl REST which has a name, tag, and an interface assigned, can you please post it here? Here's a sample of what i'm looking for for a self IP create: curl -sk -u admin:admin -H 'Content-Type: application/json' -X POST -d '{"name":"self3","address":"","vlan":"external"}'


3 Replies

  • Better late than never I suppose :). Subcollections can be a bit of a pain. You can create a vlan, assign it to an interface, and tag it in one shot like so:


    curl -sk -u admin:admin -H "Content-type: application/json" -X POST -d '{"name":"external","tag":"2","interfaces": [{"name":"1.1","tagged":true}]}'


    This works for me in ver=11.6.0


  • I figured it out. You have to do it in 2 steps, create the vlan, then modify it and assign an interface. Why? I have no idea.


    Create VLAN external




    curl -sk -u admin:admin -H 'Content-Type: application/json' -X POST -d '{"name":"vlan33","tag":"33"}'




    curl -sk -u admin:admin -H 'Content-Type: application/json' -X POST -d '{"name":"vlan34"}'


    Associate an interface with VLAN external and use the tag


    curl -k -u "admin:admin" -H "Content-Type:application/json" -X PUT -d '{"name":"interfaces", "interfaces":[{"name":"1.3","tagged":null}]}'


    Associate an interface with VLAN external and make it untagged


    curl -k -u "admin:admin" -H "Content-Type:application/json" -X PUT -d '{"name":"interfaces", "interfaces":[{"name":"1.3"}]}'