Importing rulebase into Excel using XML API

Reply
Not applicable

Importing rulebase into Excel using XML API

Hi,

i am having an issue with importing the rules base into excel using the XML API.

the query i am using is: https://hostname/esp/restapi.esp?type=config&key=keyvalue&action=show&xpath=devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules

I used the following to generate the keyvalue: https://hostname/api/?type=keygen&user=username&password=password

i have used the default admin use to create this keyvalue.

i keep getting the error error code 403. User not authorised to perform this operation.

help would be greatly appreciated as to why this user does not have access or if the query i'm using is incorrect.

L3 Networker

Re: Importing rulebase into Excel using XML API

What version of PaloAlto are you on? Older versions use esp, newer ones use api, so try this:

https://hostname/api?type=config&key=keyvalue&action=show&xpath=devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules

Not applicable

Re: Importing rulebase into Excel using XML API

we are using PANOS 4.1.7

when i try the string with api instead of esp i get the login prompt and then the dashboard same as i would is i logged in via the browser.

L3 Networker

Re: Importing rulebase into Excel using XML API

If you got 403 error, it means something wrong with your key. There is a known bug in 4.1.x that alter your key during the generation. Please try the below operational command and see if it works.

https://hostname/api/?key=keyvalue&type=op&cmd=<show><system><info></info></system></show>

If you still receive 403 error, please regenerate your key and try again. Once you've got the show system info, then try exporting your rule base again.

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!