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

Reply
L0 Member

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

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")


Accepted Solutions
Highlighted
L7 Applicator

Re: PAN-PYTHON IN TERMINAL ( see the result of "show running security-policy | match index&quot

@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

Highlighted
L4 Transporter

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

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


All Replies
Highlighted
L7 Applicator

Re: PAN-PYTHON IN TERMINAL ( see the result of "show running security-policy | match index&quot

@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

Highlighted
L4 Transporter

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

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

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!