Getting all Network Objects & Addresses via API

Reply
L2 Linker

Getting all Network Objects & Addresses via API

Hi all,

 

In working with the PAN-OS API on v7, I have been trying to figure out the appropriate way to get all of the network objects and their associated addressesF15 recognized by my firewall.

 

Tried the following query but only seems to return an error code of 7, so I'm not sure if that means my query is malformed or if what I'm asking it for is the wrong request type:

 

Tried via Windows PowerShell:

 

Invoke-RestMethod -Method GET -Uri

"https://MYFIREWALL/api/?type=config&action=get&key=MYAPIKEY&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/address-group"

 

If anyone could point me in the right direction, I would be greatly appreciative.

Community Team Member

Re: Getting all Network Objects & Addresses via API

Hi @f1r3withf1r3,

 

This might be of help to you :

 

How to Export Address and Address-group Objects Using PAN-OS API:

https://live.paloaltonetworks.com/t5/Tutorials/How-to-Export-Address-and-Address-group-Objects-Using...

 

Cheers !

-Kiwi

L2 Linker

Re: Getting all Network Objects & Addresses via API

Thanks @kiwi

 

Based on the documentation for that perl package, looks like its instructions are for linux admins.

 

While this is possible in my particular case, for the sake of future Googlers, is there any guide on making that work in Windows via CygWin/PAN-Perl/Excel?

 

Gluing that together is not readily understandable from the page initially provided. Any pointers would be helpful.

 

 

L7 Applicator

Re: Getting all Network Objects & Addresses via API

@f1r3withf1r3,

To the best of my knowledge PAN-perl is depreciated and really isn't recommended anymore, pan-python would be more of the direction most are taking, or Device Framework. 

That being said if you are in a Windows envrioment I would really recommend simply learning the API before you start incorporating any of the other tools that Palo Alto and users have published for use in other languages. Knowing what the command you are issueing is actually doing on your system is something that I deam pretty essential. 

 

 

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!

The Live Community thanks you for your participation!