- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
02-24-2022 07:25 PM
Settings
What's expected:
What's happening:
Your help is much appreciated.
02-25-2022 05:45 AM - edited 02-25-2022 05:47 AM
Hi @HermanEdwards, audit comments are not stored in the configuration, hence you don't see it in the API browser. There is an operational CLI command that shows the audit comments (show config list audit-comments xpath {{xpath to security policy rule}}) and this translates to XML API call:
https://{{host}}/api/?key={{key}}&type=op&cmd=<show><config><list><audit-comments><xpath>/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='{{device-group-name}}']/pre-rulebase/security/rules/entry[@name='{{rule-name}}']</xpath></audit-comments></list></config></show>
Sometimes external XML API calls are not exact replicas of the web GUI behaviour.
Hope that helps!
02-24-2022 07:28 PM
Reposting the 2 images, since the first 2 look very blurry:
1. Missing Audit comment field under the Policy rule
2. Network tab proves that we should have that field
02-25-2022 05:45 AM - edited 02-25-2022 05:47 AM
Hi @HermanEdwards, audit comments are not stored in the configuration, hence you don't see it in the API browser. There is an operational CLI command that shows the audit comments (show config list audit-comments xpath {{xpath to security policy rule}}) and this translates to XML API call:
https://{{host}}/api/?key={{key}}&type=op&cmd=<show><config><list><audit-comments><xpath>/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='{{device-group-name}}']/pre-rulebase/security/rules/entry[@name='{{rule-name}}']</xpath></audit-comments></list></config></show>
Sometimes external XML API calls are not exact replicas of the web GUI behaviour.
Hope that helps!
02-25-2022 11:30 AM
@JimmyHolland Thank you very much! This is working.
It looks like Audit comment need to be created only after a policy has been created. This is b/c it relies on a separate API call (i.e. type='op') here.
Also, the CLI is great! I find that we can perform the Audit comment create/update with `set audit-comment comment "my update via cli" xpath <path_to_policy_node"`
It's also displayed under Web API explorer:
02-25-2022 06:24 PM
@JimmyHolland When you have time, do you know if a Device entry name (e.g. 'localhost.localdomain') is always required in the xpath? Can it be left as blank? If blank, does it default to some values?
For more info, when submitting the Audit comment update without specifying the Device entry name, the update is still successful. However, the update is applied to the wrong path, resulting in no update on the UI. This makes sense, as the xpath should represent a path to certain object.
However, I see examples where Device entry name is left as blank on XML API guide. I'm wondering if some default value get used when entry is blank. Or if I should always default the Device entry name to 'localhost.localdomain' (i.e. I assume all Panorama come with the device entry name 'localhost.localdomain')
03-04-2022 04:27 AM
Hi @HermanEdwards, I answered this in your separate thread, and the localhost.localdomain is indeed required.
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!