Skip to main content
akaratas
Staff
Staff
April 1, 2026

Technical Tip: How to add a single VLAN via API

  • April 1, 2026
  • 0 replies
  • 98 views

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: