Technical Tip: How to add a single VLAN via API
Description
Â
This article describes how to single VLAN on FortiManager via API.
Â
Scope
Â
FortiManager.
Â
Solution
Â
The following example shows the steps required to create a Vlan_10 interface on the managed device fgt1.
Â
API query request:
{
 "id": 1,
 "method": "add",
 "params": [
   {
     "data": {
       "interface": "port1",
       "name": "Vlan_10",
       "vdom": "root",
       "vlanid": 10
     },
     "url": "/pm/config/device/fgt1/global/system/interface"
   }
 ],
 "session": "{{session_id}}"
}Â
API response:
{
 "id": 1,
 "result": [
   {
     "data": {
       "name": "Vlan_10"
     },
     "status": {
       "code": 0,
       "message": "OK"
     },
     "url": "/pm/config/device/fgt1/global/system/interface"
   }
 ]
}Â
Note: In the response, the name attribute specifies the name of the newly created VLAN.
Troubleshooting:
The following commands can be used on the FortiManager CLI to debug the REST API Calls:
diagnose debug service httpd 255
diagnose debug service main 255Â
Related documents:
