XML and XPath
Table of Contents
Expand all | Collapse all
-
- Upgrade a Firewall to the Latest PAN-OS Version (API)
- Show and Manage GlobalProtect Users (API)
- Query a Firewall from Panorama (API)
- Upgrade PAN-OS on Multiple HA Firewalls through Panorama (API)
- Automatically Check for and Install Content Updates (API)
- Enforce Policy using External Dynamic Lists and AutoFocus Artifacts (API)
- Configure SAML 2.0 Authentication (API)
- Quarantine Compromised Devices (API)
- Manage Certificates (API)
-
- Asynchronous and Synchronous Requests to the PAN-OS XML API
- Run Operational Mode Commands (API)
- Apply User-ID Mapping and Populate Dynamic Groups (API)
- Get Version Info (API)
-
- PAN-OS REST API
- Access the PAN-OS REST API
- Resource Methods and Query Parameters (REST API)
- PAN-OS REST API Request and Response Structure
- PAN-OS REST API Error Codes
- Work With Objects (REST API)
- Create a Security Policy Rule (REST API)
- Work with Policy Rules on Panorama (REST API)
- Create a Tag (REST API)
- Configure a Security Zone (REST API)
- Configure an SD-WAN Interface (REST API)
- Create an SD-WAN Policy Pre Rule (REST API)
- Configure an Ethernet Interface (REST API)
- Update a Virtual Router (REST API)
- Work With Decryption (APIs)
XML and XPath
The PAN-OS XML API uses XML for both requests and responses.
When making requests, construct an HTTPS GET or POST request with
the correct type and action along with the correct XPath. Here is
an example API request:
curl -X POST 'https://firewall/api?type=config&action=show&key=<APIkey>&xpath=/config/devices/entry/vsys/entry/rulebase/security"
Ensure you replace variables such as <hostname> and <APIkey> with
the IP address or hostname of your firewall or Panorama and API
key, respectively.
When making configuration requests (type=config),
you can use XPath, a syntax for selecting nodes from within an XML
document. Use the XPath to isolate and modify portions of your configuration.
The XML configuration within PAN-OS uses four different types of
nodes as shown here:
<users> <entry name="admin"> <permissions> <role-based> <superuser>yes</superuser> </role-based> </permissions> </entry> <entry name="guest"> <permissions> <role-based> <custom> <profile>NewUser</profile> </custom> </role-based> </permissions> </entry> </users>
- Root nodes are top-level nodes with no parent. Requesting the root node returns all child elements.
- Element nodes represent containers of information. Element nodes can contain other element nodes or simply act as a container of information. Example:<permissions></permissions>
- Attribute nodes are nodes that contain name/value pairs. Example:<entry name="admin"></entry>
- Text nodes contain plain text. Example:<superuser>yes</superuser>
Explore
the API with the API browser, CLI, or debug console to learn
how to construct XML requests.