paloaltonetworks:api:scripts:example
This is an old revision of the document!
Scripting Examples
Example Script
Here is an example of using Curl in a batch script. You will need to remove the ECHO from the last line in order for the batch file to actually run the command. As it stands, it will just print the command to the screen.
@echo off SET KEY=YOUR_API_KEY_HERE SET FIREWALL_IP=FIREWALL_IP_HERE SET TYPE=user-id SET VSYS=vsys1 SET ACTION=set SET CMD=%%3Cuid-message%%3E%%3Cversion%%3E1.0%%3C/version%%3E%%3Ctype%%3Eupdate%%3C/type%%3E%%3Cpayload%%3E%%3Clogin%%3E%%3Centry%%20name=%%22username-here%%22%%20ip=%%22192.168.1.1%%22%%20timeout=%%220%%22/%%3E%%3C/login%%3E%%3C/payload%%3E%%3C/uid-message%%3E SET URL=https://%FIREWALL_IP%//api/?type=%TYPE%^&vsys^=%VSYS%^&key^=%KEY%^&action=%ACTION%^&cmd=%CMD%" SET CURL_COMMAND=curl --insecure -g -X GET "%URL% ECHO %CURL_COMMAND%
paloaltonetworks/api/scripts/example.1590236058.txt.gz · Last modified: (external edit)
