Skip to main content
akaratas
Staff
Staff
October 22, 2024

Technical Tip: How to get managed devices list for All ADOMs and Specific ADOM using API query

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

 

This article describes how device list information can be taken from FortiManager for all ADOMs and specific ADOMs using an API query.

 

Scope

 

FortiManager, FortiManager Cloud.

 

Solution

 

The following example below explains how to get managed devices for test1 ADOM:

 

API Request is below:

 

{

  "id": 3,

  "method": "get",

  "params": [

    {

      "fields": [

        "name",

        "sn"

      ],

      "option": [

        "no loadsub"

      ],

      "url": "/dvmdb/adom/test1/device"

    }

  ],

  "session": "{{session}}",

  "verbose": 1

}

 

Note:

'no  loadsub option' and 'fields attributes' need to be used to decrease the number of returned data.

 

 

How to get a list of managed devices for all ADOMs.

API Request is below:

 

{

  "id": 3,

  "method": "get",

  "params": [

    {

      "expand member": [

        {

          "fields": [

            "name",

            "sn"

          ],

          "url": "device"

        }

      ],

      "fields": [

        "name",

      ],

      "filter": [

        "restricted_prds",

        "==",

        "fos"

      ],

      "option": [

        "no loadsub"

      ],

      "url": "/dvmdb/adom/"

    }

  ],

  "session": "{{session}}",

  "verbose": 1

}

 

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

 

Related articles: