Hi all -
I have been fighting with the FortiManager API for a while now. With a Python script, I've been able to:
I am struggling with figuring out how to pull the switch details for:
I'm pretty sure I can get it pretty easy from the FortiOS directly, but I'm really hoping to pull the details from FortiManager with the same "connection". I can see the details in FortiManager under FortiSwitches.
Any ideas anyone?
Thanks,
-Todd
Solved! Go to Solution.
I think I found the issue... The only thing that I changed was:
url_path = f"/pm/config/adom/{adom_name}/obj/fsp/managed-switch"
# If we want to filter by a specific device, we can add scope
data = None
if device_name:
print(f"Filtering switches for device: {device_name}")
data = {
"scope member": {
"name": device_name
}
}
response = self._make_request(url_path, method="get", data=data, verbose=True)
"verbose=True"
Hi Todd
From the docs, it looks like you should be targetting:
/pm/config/adom/<ADOM_NAME>/obj/fsp/managed-switch
The table returns platform and vlan interface.
Regards
Thanks for the reply Richie.
I have been fighting with "/pm/config/device/{device}/vdom/{vdom}/switch-controller/managed-switch/{switch-id}" thinking the data should be there, but never got the results I expected.
I thought the "/pm/config/adom/<ADOM_NAME>/obj/fsp/managed-switch" was for FortiOS as I was reading through the docs. I do see that it is recognized by FortiManager. I'm still working on the details... Currently trying:
url_path = f"/pm/config/adom/{adom_name}/obj/fsp/managed-switch"
data = None
if device_name:
print(f"Filtering switches for device: {device_name}")
data = {
"scope member": [
{
"name": device_name,
"vdom": "root"
}
]
}
Output is not working... yet...
{'id': 1,
'result': [{'data': [],
'status': {'code': 0, 'message': 'OK'},
'url': '/pm/config/adom/{redacted adom}/obj/fsp/managed-switch'}]}
I'm not giving up yet.
Thanks,
-Todd
I think I found the issue... The only thing that I changed was:
url_path = f"/pm/config/adom/{adom_name}/obj/fsp/managed-switch"
# If we want to filter by a specific device, we can add scope
data = None
if device_name:
print(f"Filtering switches for device: {device_name}")
data = {
"scope member": {
"name": device_name
}
}
response = self._make_request(url_path, method="get", data=data, verbose=True)
"verbose=True"
The API preview option may help FortiManager 7.6 Features - Preview configuration changes in JSON API and CLI format | Fortinet Vide... also CLI scripts | FortiManager 7.6.3 | Fortinet Document Library are there is anything is not supported.
Outside of that Fortinet Developer Network is for API but for some reason Fortinet wants 2 employees to approve this so see with your sales/account.
User | Count |
---|---|
2642 | |
1405 | |
810 | |
685 | |
455 |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.