04-25-2019 02:08 PM
I am trying to create a new address group using API but I always end up getting
<response status="error" code="12">
Can someone help me with the correct xpath to create a new shared address group empty or with a list of address objects.
04-25-2019 02:20 PM - edited 04-25-2019 02:24 PM
If you're using PAN-OS 9.0, I recommend the new REST API. You don't need XPaths to create Address Groups with the new REST API:
If you're using python, you might consider leveraging the Device Framework library. Here's an example of how to create an Address Object.
Address Groups are very similar:
If you're using GoLang, we also have the PanGo library:
If you're not using Python or Go, you can check out this XML API tutorial lab:
It uses pan-python library, but you don't need python code to use it. There are several examples of creating Address Objects and Address Groups with XPaths and XML.
Hope that helps!
04-25-2019 02:38 PM
Thanks for the reply. I have been trying to use https://docs.paloaltonetworks.com/pan-os/9-0/pan-os-panorama-api.html#.
I am using JAVA to create address Groups and rules. And this doesnt work -
where the xpath-value is:
I am able create address objects using xpath = /config/shared/address/entry[@name='hostname'] and body/ element as element=<ip-netmask>"+ip+"</ip-netmask>.
But a similar one above doesnt work for address groups.
what is supposed to be the devices entry name and vsys entry name?
04-25-2019 02:40 PM - edited 04-25-2019 02:40 PM
I keep getting
<response status="error" code="13">
<line>Could not find schema node for xpath /config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='device-group-name']/address-group</line>
05-01-2019 08:02 PM
see tool I've shared which can do this for you.
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!