Technical Tip: Find and replace an address object using the JSON API
- December 24, 2025
- 0 replies
- 241 views
| Description | This article describes how to Find and Replace an address object used in policy package using JSON API. |
| Scope | FortiManager, Postman. |
| Solution | The Find and Replace address object (or any ADOM level object) involves three steps:
The following process details how to achieve this:
{ "method": "exec", "params": [ { "url": "cache/search/where/used/start", "data": { "obj": "adom/{{ADOM}}/obj/{{Object_Type}}", "mkey": "{{Object_Find}}", "flags": [ "direct used" ] } } ], "id": "2", "session": "{{session}}", "verbose": 1 }
For example:
The output of this request generates a 'token', which is then used in the next query.
{ "method": "exec", "params": [ { "url": "cache/search/where/used/get/detail", "token": "{{token}}" } ], "id": "1", "session": "{{session}}", "verbose": 1 }
In this example, there is an address object 'Test1' that has been used in two firewall polices in a policy package (as seen in step 2 output). Consequently, two requests are required to replace it with another object, 'Test2'.
{ "method": "update", "params": [ { "url": `pm/config/adom/${adom}/pkg/${policy.package_name}/firewall/policy/${policy.policy_id}`, "used objs": { "from": `obj/${objecttype}/${objectFind}`, "to": [ `${objectReplaceWith}` ] } } ], "id": 3, "session": sessionTokenValue };
Postman Release Notes |



