Skip to main content
Gerhardt7
New Member
June 26, 2025
Question

Adding device mapping to dynamic adres object Fortimanager with a python api/json script

  • June 26, 2025
  • 1 reply
  • 1304 views

Hello Fortinet Community,

I’m currently working on automating firewall address object updates in FortiManager via the JSON RPC API. My goal is to programmatically add entries to the dynamic_mapping array of a firewall address object.

Here is the structure of the dynamic_mapping entry I am trying to add (simplified example):

{
"_scope": [
{
"name": "DeviceName",
"vdom": "root"
}
],
"allow-routing": 0,
"associated-interface": "any",
"clearpass-spt": 0,
"color": 0,
"dirty": 1,
"fabric-object": 0,
"node-ip-only": 0,
"obj-type": 9,
"route-tag": 0,
"subnet": [
"10.164.110.0",
"255.255.255.0"
],
"type": 0
}

Error i get:

{'code': -10, 'message': 'The data is invalid for selected url'}

 

Could anyone please advise what might be missing or incorrect in the payload format for dynamic_mapping? Are there any known quirks or additional required fields? Any examples of a working dynamic_mapping update via API would be greatly appreciated.

Thanks in advance for your help!

Its part of a script what checks automatic interfaces on fortigates and when a dynamic adress not exist he must add it to the object. 

 

 

1 reply

Gerhardt7
Gerhardt7Author
New Member
June 26, 2025

The solution was to use “add” instead of “update” when adding dynamic mappings to the address object via the API.

Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
Virtual event | September 2026. SASE summit. The age of autonomous trust. Register here!