Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
Gerhardt7
New Contributor

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

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 1
Gerhardt7
New Contributor

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

Announcements
Check out our Community Chatter Blog! Click here to get involved
Labels
Top Kudoed Authors