Structure of a PAN-OS XML API Request
A PAN-OS XML API request typically comprises a number of parameters, as shown in the example below:
curl -X GET "https://<firewall>/api/?type=<type>&action=<action>&xpath=<xpath>&key=<apikey>"
- API key (key=): The API key allows you to authenticate yourself to the API when making requests. Learn about API Authentication and Security and how to Get Your API Key.
- Request type (type=): Because the XML API allows you to perform a wide array of requests, you must first specify the type of request you want, ranging from configuration to operation, importing to exporting, and from reports to user ID. Learn more about Request Types.
- Action (action=): When the request type isconfig(configuration) orop(operational mode command), you must also specify an associated action, such asedit,delete, ormove. Learn more about Configuration Actions.
- XML and XPath elements (xpath=orcmd=): When using configuration or operational mode commands on the firewall, you include only the XML or the XPath that specifies the XML node. Learn more about XML and XPath and XPath Node Selection.
To make requests to the PAN-OS XML API, you can use the GET and POST methods.
Use a GET request when the query size is less than 2K and you want to pass strings in the Request URL. When using the GET method, append the query string to the request URL as a URL-encoded parameter string:
Use a POST request when you are sending large amounts of form data (the request size is between 2K to 5MB; limit the request size to 5MB) or when you are passing non-ASCII characters. Some API requests, such as importing files, require POST. When using the POST method, pass the parameters in the request body. In this example, the request body includes the login credentials:
POST /api/ HTTP/1.1 Content-Type: application/x-www-form-urlencoded password=<password>&user=<username>&type=keygen
If you want to learn about the PAN-OS REST API structure, see PAN-OS REST API Request and Response Structure.
Recommended For You
Recommended videos not found.