Use the CLI to Find XML API Syntax
Table of Contents
                    
					9.1 (EoL)
						
				
		
  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)
 
 - 
          
                
- 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)
 
 
                            End-of-Life (EoL)
                        
                    Use the CLI to Find XML API Syntax
Another method to determine the appropriate
XML syntax and XPath for your API calls is through the command-line interface (CLI).
This method works for type=op and type=config API
calls.
To learn about changes to the latest version
of CLI commands that affect corresponding PAN-OS XML API requests,
see the PAN-OS CLI Quick Start.
Use
the CLI to enable debug mode and then run the CLI command to receive the
corresponding XML and XPath in the response.
- Access the CLI.Use an SSH client or terminal to access your firewall or Panorama CLI.
 - Enable debug mode.Enter the following command:
debug cli on - Run a CLI command.Enter and run a CLI command. Example:test url http://paloaltonetworks.com <request cmd="op" cookie="7581536015878829" uid="1206"><operations><test><url>http://paloaltonetworks.com</url></test></operations></request>
- Use the resulting response to create an API call.
 Use the cmd value and the XML elements within the operations tag to form the API call:https://<firewall>/api/?type=op&cmd=<test><url>http://paloaltonetworks.com</url></test>&key=<apikey>Depending on the CLI command, the XML tag values for cmd will vary. For example, here is a CLI command for showing firewall information: run show system infoThe corresponding API call for the CLI command:https://<firewall>/api/?type=op&cmd=<show><system><info></info></system></show>&key=<apikey> - Use the resulting response to create an API call.