- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
06-20-2025 07:14 AM
Hi All,
I am trying to test XML API for global search . I am trying to use for search security rule with given description .
ANy help for this.
06-20-2025 08:10 AM
This is doing a lot of parsing of the configuration directly and isn't a feature or function that you can interact with via the API. You would need to essentially replicate the functionality (probably in a more targeted manner to make it easier) and find any matches. I've included a very basic example below given your desire to look at security rulebase entries:
ExampleDescription = 'This is a test description'
GetSecRulebase = requests.get("https://myFirewallUrl/api/?type=config&action=get&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules",headers=headers)
SecRulebase = xmltodict.parse(GetSecRulebase.content)
SecEntries = SecRulebase['response']['result']['rules']['entry']
for SecEntry in SecEntries:
entryName = SecEntry['@name']
entryDescription = SecEntry['description']
if entryDescription == str(ExampleDescription):
print("Entry '" + str(entryName) + "' matches the ExampleDescription")
You could then obviously take this minimal example and update it to account for whatever you are actually attempting to do.
06-20-2025 08:10 AM
This is doing a lot of parsing of the configuration directly and isn't a feature or function that you can interact with via the API. You would need to essentially replicate the functionality (probably in a more targeted manner to make it easier) and find any matches. I've included a very basic example below given your desire to look at security rulebase entries:
ExampleDescription = 'This is a test description'
GetSecRulebase = requests.get("https://myFirewallUrl/api/?type=config&action=get&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules",headers=headers)
SecRulebase = xmltodict.parse(GetSecRulebase.content)
SecEntries = SecRulebase['response']['result']['rules']['entry']
for SecEntry in SecEntries:
entryName = SecEntry['@name']
entryDescription = SecEntry['description']
if entryDescription == str(ExampleDescription):
print("Entry '" + str(entryName) + "' matches the ExampleDescription")
You could then obviously take this minimal example and update it to account for whatever you are actually attempting to do.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!