PAN-PYTHON IN TERMINAL ( see the result of "show running security-policy | match index")

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

PAN-PYTHON IN TERMINAL ( see the result of "show running security-policy | match index")

L0 Member

We get output for command ""show running security-policy"

 

However, what should be the format if we use "|"

i.e > what would be the format for the command  ( see the result of "show running security-policy | match index")

2 accepted solutions

Accepted Solutions

Cyber Elite
Cyber Elite

@amartin,

So first and foremost, I wouldn't be publishing an API key on the internet. I don't think you can pipe output directly in the API like this; you would need to parse the result. 

View solution in original post

Agree with @BPry . To add a little context, the pipe concept is a CLI construct, so it doesn't really apply to an API. This is made confusing by the fact that the PAN-OS API allows you to send it CLI commands, but a pipe on CLI is multiple commands sent together, which can't be done via API.

 

Since the API output is a parsable structure like XML or JSON, the best way to get what you need is to pull it out of the output using existing XML and JSON tools. This makes it easy to collect or filter to the exact information you need based on your own criteria and do whatever you want with it, as opposed to the CLI which has limited filtering and output options.

 

Hope that helps! Let us know if you need help figuring out a parsing strategy for whatever programming language you're using.

View solution in original post

2 REPLIES 2

Cyber Elite
Cyber Elite

@amartin,

So first and foremost, I wouldn't be publishing an API key on the internet. I don't think you can pipe output directly in the API like this; you would need to parse the result. 

Agree with @BPry . To add a little context, the pipe concept is a CLI construct, so it doesn't really apply to an API. This is made confusing by the fact that the PAN-OS API allows you to send it CLI commands, but a pipe on CLI is multiple commands sent together, which can't be done via API.

 

Since the API output is a parsable structure like XML or JSON, the best way to get what you need is to pull it out of the output using existing XML and JSON tools. This makes it easy to collect or filter to the exact information you need based on your own criteria and do whatever you want with it, as opposed to the CLI which has limited filtering and output options.

 

Hope that helps! Let us know if you need help figuring out a parsing strategy for whatever programming language you're using.

  • 2 accepted solutions
  • 4421 Views
  • 2 replies
  • 0 Likes
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 LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!