Example: Creating a VLAN and a VLAN interface using REST APIs

This example shows creating the following VLAN and interface configuration on a switch at IP address 192.0.2.5:

vlan 2 no shutdown interface vlan 2
  1. 创建VLAN。

    美元curl——noproxy192.0.2.5 -k -X POST \ -b /tmp/auth_cookie -d '{ "name":"vlan2", "id":2, "type":"static", "admin":"up"}' \ "https://192.0.2.5/rest/v10.04/系统/ vlan”
  2. Creating an interface with VLAN information

    美元curl——noproxy192.0.2.5 -k -X POST \ -b /tmp/auth_cookie -d '{ "vrf": "/rest/v10.04/system/vrfs/default", "vlan_tag":"/rest/v10.04/system/vlans/2", "name":"vlan2", "type":"vlan"}' \ -D- "https://192.0.2.5/rest/v10.04/system/interfaces"