Skip to Content

How to get and update firewall addresses using JSON API

This article describes how to get and update firewall addresses using JSON API.

Scope

FortiManager.

Solution

All objects have prefix ‘/pm/config/global/obj/’ or ‘/pm/config/adom/obj/’ for the Global or ADOM level.

API URL for ‘Firewall Address’:

"url": /pm/config/adom/<adom_name>/obj/firewall/address"

For a complete list of FortiManager API calls, refer to Fortinet Development Network (FNDN).

Get Firewall Address

Sample JSON-API by filter specific firewall address:

{
"method": "get",
"params": [ {
"url": "/pm/config/adom/root/obj/firewall/address",
"filter": [ "name","==","testt-firewall-address"]
} ],
"session":"{{session}}",
"id": 1
}

Sample output:

Get Firewall Address

Update Firewall Address

Sample JSON-API to update specific firewall address > Subnet:

{
"method": "update",
"params": [ {
"data": [ {
"name": "testt-firewall-address",
"subnet": [
"220.110.110.110",
"255.255.255.255"
]
} ],
"url": "/pm/config/adom/root/obj/firewall/address"
} ],
"session":"{{session}}",
"id": 1
}

Sample output:

Update Firewall Address

Troubleshooting

The following commands can be used on FortiManager CLI to debug the REST API Calls for ADOM objects:

diagnose debug service main 255
diagnose debug service cdb 255
diagnose debug enable