API in python works but in browser fails

Reply
Highlighted
L4 Transporter

API in python works but in browser fails

Trying the API in browser. Clicking either submit or the URL give me error "show rule hit count op-command failed'

Tried on 5250 multi-vsys and 220, both on 8.1.8-h5

 

image.png

 

 

 

 

https://PA/api/?REST_API_TOKEN=111111111&type=op&cmd=%3Cshow%3E%3Crule-hit-count%3E%3Cvsys%3E%3Cvsys-name%3E%3C%2Fvsys-name%3E%3C%2Fvsys%3E%3C%2Frule-hit-count%3E%3C%2Fshow%3E

 

 

 

 

I managed to run the code and used on my firewall and was successful. But direct browsing fails.

 

https://panos.pan.dev/docs/apis/panos_tutorials_rule_hit_count

 

This uses

 

 

<show><rule-hit-count><vsys><vsys-name><entry name='vsys1'><rule-base><entry name='security'><rules><all></all></rules></entry></rule-base></entry></vsys-name></vsys></rule-hit-count></show>"

 

 

 

Highlighted
L4 Transporter

Re: API in python works but in browser fails

The reason it's failing is because the GUI API browser is already at the following XML location (per your first screenshot):  show > rule-hit-count > vsys > vsys-name

 

The API browser kinda fails when you need to give multiple params at a specific depth...  I don't know if it'd work, but you could try going back to the vsys location, then pasting the entire vsys-name block from opening to close and see if that works..?

L4 Transporter

Re: API in python works but in browser fails

@gfreeman I browsed API till vsys-name and there is nothing below it. Also i tried going up it still failed.

Then i copied the text above and it showed results although not human readable

 

image.png

 

image.png

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!