Skip to main content
tnesh
Staff & Editor
Staff & Editor
February 20, 2026

Technical Tip: How to get administrator details from all managed FortiGates using FortiManager JSON API

  • February 20, 2026
  • 0 replies
  • 369 views
Description

This article describes how to get user administrator details from all managed FortiGates using FortiManager API & Postman.

Scope FortiManager, FortiGate, JSON API.
Solution

Before taking any of the steps below, obtain the JSON API Session ID.

Note: The session ID will be used in following JSON API request.

 

{     "id": 1,     "method": "exec",     "params": [{         "data": {             "user": "{{admin}}",             "passwd": "{{password}}"         },         "url": "/sys/login/user"     }] }

 

Step 1: Retrieve FortiGate 'Device Name' in FortiManager.

 

  1. (Body): JSON API.

 

{   "id": 1   "method": "get",   "params": [     {       "url": "/dvmdb/device"     }   ],   "session": "{{session}}",   "verbose": 1, }

 

  1. (Scripts): Script to store 'Device Name' into variable 'device_targets'.

 

// Parse response JSON let response = pm.response.json();  // Filter out devices with os_type === "faz" let filteredDevices = response.result[0].data.filter(device => device.os_type !== "faz");  // Extract device names and prefix with "device/" let deviceTargets = filteredDevices.map(device => `device/${device.name}`);  // Log it console.log("Device targets (excluding 'faz'):", deviceTargets);  // Store JSON string in collection variable pm.collectionVariables.set("device_targets", JSON.stringify(deviceTargets));

 

Example:

 

get-device-list.png

 

Step 2: Get Administrator details:

 

  1. Use the following JSON API request to get all fields:

 

{     "id": "2",     "method": "exec",     "params": [         {             "url": "sys/proxy/json",             "data": {                 "target": {{device_targets}},                 "action": "get",                 "resource": "/api/v2/cmdb/system/admin"             }         }     ],     "session": "{{session}}" }

 

  1. Use the following JSON API request to get only certain fields. Example: 'name' & 'accprofile'.

 

{     "id": "2",     "method": "exec",     "params": [         {             "url": "sys/proxy/json",             "data": {                 "target": {{device_targets}},                                 "action": "get",                 "resource": "/api/v2/cmdb/system/admin?format=name|accprofile"             }         }     ],     "session": "{{session}}" }

 

Example:

 

format-result_json.png

 

  1. (Optional) Update the results in table format using scripts:

For example:

 

format-result_table-view.png

 

Note: The attached Postman collection contains the JSON and scripts used in this article.  

 

Troubleshooting:

The following commands can be used on the FortiManager CLI to debug the API Calls:

 

diagnose debug service httpd 255

diagnose debug service main 255

diagnose debug enable

 

Related documents: