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
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.
  1. Access the CLI.
    Use an SSH client or terminal to access your firewall or Panorama CLI.
  2. Enable debug mode.
    Enter the following command:
    debug cli on
  3. Run a CLI command.
    Enter and run a CLI command. Example:
    test url
    <request cmd="op" cookie="7581536015878829" uid="1206"><operations><test><url></url></test></operations></request>
  4. Use the resulting response to create an API call.
    Use the
    value and the XML elements within the
    tag to form the API call:
    Depending on the CLI command, the XML tag values for
    will vary. For example, here is a CLI command for showing firewall information:
    run show system info
    The corresponding API call looks like this:
    curl -X GET "https://<firewall>/api/?type=op&cmd=<show><system><info></info></system></show>&key=<apikey>"

Recommended For You