05-10-2021 04:07 AM
I am trying to delete certain objects using FTD Rest API such as network objects or url objects.
Whenever one of them is being used by a rule or a group, the deletion is being prevented.
I was trying to find a way to get all usages of an object so I could clean it up before deletion, but didn't see one.
Is there an API that gives back all references of an object?
Thank you in advance.
Solved! Go to Solution.
05-10-2021 12:28 PM
I wish I had a better answer for you but we don't have a usages API at the moment I can tell you this is something we have talked about internally and there were some prototypes but it hasn't made it into a release yet. I very much understand the ask and I can totally see the usefulness as we wanted something similar to show usages in the user interface. (I'll do my best to push for this next time I get a chance)
My suggestion in the meantime would be to check the usual suspects:
- Access Rules
- Decryption Rules
- Identity Rules
- RA VPN
And check if you have a reference to that ID value. If you wanted to make a crude script to accomplish this you could look for any JSON document that has a nested dict with an "id" field defined with the "type" the same as the object that you are investigating. I know this isn't super efficient but that is probably the best answer until we make a purpose-built API (which would be much simpler..).
05-10-2021 01:17 PM
One quick follow-up as I just received a suggestion that we also have a free text search API which could be used to simplify a bit. For example, if you want to find all-access rules that reference a host object named "test_host" you can formulate a query as follows:
https://host:443/api/fdm/v6/policy/accesspolicies/default/accessrules?filter=fts:test_host
This will make it so you don't have to crawl all objects of a given type for the major policy type objects Access, Decryption(SSL), and Identity.
You'd still have to query per type but you'd get a more concise answer this way. I just tried it on my FDM with 2 rules and it picked the correct rule.
05-10-2021 12:28 PM
I wish I had a better answer for you but we don't have a usages API at the moment I can tell you this is something we have talked about internally and there were some prototypes but it hasn't made it into a release yet. I very much understand the ask and I can totally see the usefulness as we wanted something similar to show usages in the user interface. (I'll do my best to push for this next time I get a chance)
My suggestion in the meantime would be to check the usual suspects:
- Access Rules
- Decryption Rules
- Identity Rules
- RA VPN
And check if you have a reference to that ID value. If you wanted to make a crude script to accomplish this you could look for any JSON document that has a nested dict with an "id" field defined with the "type" the same as the object that you are investigating. I know this isn't super efficient but that is probably the best answer until we make a purpose-built API (which would be much simpler..).
05-10-2021 01:17 PM
One quick follow-up as I just received a suggestion that we also have a free text search API which could be used to simplify a bit. For example, if you want to find all-access rules that reference a host object named "test_host" you can formulate a query as follows:
https://host:443/api/fdm/v6/policy/accesspolicies/default/accessrules?filter=fts:test_host
This will make it so you don't have to crawl all objects of a given type for the major policy type objects Access, Decryption(SSL), and Identity.
You'd still have to query per type but you'd get a more concise answer this way. I just tried it on my FDM with 2 rules and it picked the correct rule.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide