Skip to main content
akaratas
Staff
Staff
October 22, 2024

Technical Tip: How to add a real FortiGate device to FortiManager using an API query

  • October 22, 2024
  • 0 replies
  • 1509 views
Description

 

This article describes how to add a FortiGate as a real device to FortiManager using API query. This can help while recovering FortiManager to synchronize old configuration with new configuration.

 

Scope

 

FortiManager, FortiManager Cloud.

 

Solution

 

The following example shows how to add test1 in the demo ADOM.

API query Request:

 

{

  "id": 3,

  "method": "exec",

  "params": [

    {

      "data": {

        "adom": "demo",

        "device": {

          "adm_pass": "fortinet",

          "adm_usr": "admin",

          "ip": "10.10.10.10",

          "mgmt_mode": "fmg",

          "name": "test1"

        },

        "flags": [

          "create_task"

        ]

      },

      "url": "/dvm/cmd/add/device"

    }

  ],

  "session": "{{session}}"

}

 

Note:

  • If this API request is blocked, the system responds only once the device will be added within FortiManager.
  • The create_task flag can help FortiManager create a task that can be referred to in case the add device operation fails.
  • To get a non-blocking operation, it needs to be added the nonblocking flag:

 

"flags": [

"create_task",

"nonblocking"

]

 

Troubleshooting:

The below commands can be used on FortiMAnager CLI to debug the API Calls:

 

diagnose debug service httpd 255

diagnose debug service main 255

diagnose debug service task 255

 

Related documents: