0% found this document useful (0 votes)
36 views

Python Rest API Through Json

The document provides examples of REST API calls to check objects and policies, and create an object on a Palo Alto Networks firewall. The examples show how to make GET requests to retrieve addresses and security rules, and a POST request to define a new address object with a name, description, and IP address.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Python Rest API Through Json

The document provides examples of REST API calls to check objects and policies, and create an object on a Palo Alto Networks firewall. The examples show how to make GET requests to retrieve addresses and security rules, and a POST request to define a new address object with a name, description, and IP address.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

Checking an Object:

curl -k -X GET "https://PUT_YOUR_FIREWALL_IP_HERE/restapi/9.0/Objects/Addresses?


location=vsys&vsys=vsys1&key=PUT_YOUR_API_KEY_HERE" | jq

*************curl -k -X GET "https://192.168.1.70/restapi/9.0/Objects/Addresses?


location=vsys&vsys=vsys1&key=LUFRPT11akY5ZUtVbGc0bXNlakdJMWtwSHdEa1ArbEk9VHJYVH
NFZ1BmeVBnLzliWHFLZWozS2luQ1BVYk4rT0NNZXNTT1NMVGZEb0RsVGVPWndkRTBwNXJXR3
NtSnlkUw==" | jq

2. Checking Policies:

curl -k -X GET "https://PUT_YOUR_FIREWALL_IP_HERE/restapi/9.0/Policies/SecurityRules?


location=vsys&vsys=vsys1&key=PUT_YOUR_API_KEY_HERE" | jq

************curl -k -X GET "https://192.168.1.70/restapi/9.0/Policies/SecurityRules?


location=vsys&vsys=vsys1&key=LUFRPT11akY5ZUtVbGc0bXNlakdJMWtwSHdEa1ArbEk9VHJYVH
NFZ1BmeVBnLzliWHFLZWozS2luQ1BVYk4rT0NNZXNTT1NMVGZEb0RsVGVPWndkRTBwNXJXR3
NtSnlkUw==" | jq

3. Creating an Object:

curl -k -X POST "https://PUT_YOUR_FIREWALL_IP_HERE/restapi/9.0/Objects/Addresses?


location=vsys&vsys=vsys1&name=PUT_YOUR_OBJECT_NAME_HERE&key=PUT_YOUR_API_KE
Y_HERE" -d \
'{
"entry":
{ "@name" : "PUT_YOUR_OBJECT_NAME_HERE",
"description": "PUT_YOUR_DESCRIPTION HERE",
"ip-netmask" : "PUT_YOUR_OBJECT_IP_HERE" }
}' | jq

***********
curl -k -X POST "https://192.168.1.70/restapi/9.0/Objects/Addresses?
location=vsys&vsys=vsys1&name=add_10&key=LUFRPT11akY5ZUtVbGc0bXNlakdJMWtwSHdEa1A
rbEk9VHJYVHNFZ1BmeVBnLzliWHFLZWozS2luQ1BVYk4rT0NNZXNTT1NMVGZEb0RsVGVPWndk
RTBwNXJXR3NtSnlkUw==" -d '{
"entry":
{ "@name" : “add_10”,
"ip-netmask": “10.10.10.10/24” }
}' | jq

You might also like