Changes to the LIVEcommunity experience are coming soon... Here's what you need to know.
I've taken the instructions to extract the XML command from the debug console.
<request cmd="edit" obj="/config/devices/entry[@name='localhost.localdomain']/network/tunnel/ipsec/entry[@name='my-ipsec-tunnel']/disabled" cookie="7684494492332192"> <disabled>yes</disabled> </request>
When i tried using pan-python-0.14.0, it failed thus:
$ python3 panxapi.py -h my.firewall -K LUFRPT0yY2VpTWIzSjZQYUZEdzN4MHdoMXl0eFBKOUE9N29ZQ29HMndocmdLbjVJZWVkWWwrVFJPV0N6RmZVU1pJc1pjLzBnS2Fwdz0= -x -o '<request cmd="edit" obj="/config/devices/entry[@name='localhost.localdomain']/network/tunnel/ipsec/entry[@name='my-ipsec-tunnel']/disabled" cookie="7684494492332192"><disabled>yes</disabled></request>' op: error [code="17"]: " request -> disabled is unexpected" <response code="17" status="error"><msg><line> request -> disabled is unexpected</line></msg></response>
Also tried using curl:
$ curl --globoff 'https://my.firewall/api/key=LUFRPT0yY2VpTWIzSjZQYUZEdzN4MHdoMXl0eFBKOUE9N29ZQ29HMndocmdLbjVJZWVkWWwrVFJPV0N6RmZVU1pJc1pjLzBnS2Fwdz0=&type=config&action=edit&xpath=/config/devices/entry[@name='localhost.localdomain']/network/tunnel/ipsec/entry[@name='my-ipsec-tunnel']&element=<disabled>yes</disabled>' <!DOCTYPE html> <html><head><title>Document Error: Not Found</title></head> <body><h2>Access Error: 404 -- Not Found</h2> <p>Can't locate document: /api/key=LUFRPT0yY2VpTWIzSjZQYUZEdzN4MHdoMXl0eFBKOUE9N29ZQ29HMndocmdLbjVJZWVkWWwrVFJPV0N6RmZVU1pJc1pjLzBnS2Fwdz0=&type=config&action=edit&xpath=/config/devices/entry[@name=localhost.localdomain]/network/tunnel/ipsec/entry[@name=my-ipsec-tunnel]&element=<disabled>yes</disabled></p> </body> </html>
What am i missing?
Solved! Go to Solution.
No, the /disabled is necessary. Turns out that -o is for operational commands; for 'edit' commands, you have to use -e.
$ python3 panxapi.py -h my.firewall -K LUFRPT0yY2VpTWIzSjZQYUZEdzN4MHdoMXl0eFBKOUE9N29ZQ29HMndocmdLbjVJZWVkWWwrVFJPV0N6RmZVU1pJc1pjLzBnS2Fwdz0= -x -e '<disabled>yes</disabled>' "/config/devices/entry[@name='localhost.localdomain']/network/tunnel/ipsec/entry[@name='my-ipsec-tunnel']/disabled" edit: success [code="20"]: "command succeeded" <response code="20" status="success"><msg>command succeeded</msg></response>
No, the /disabled is necessary. Turns out that -o is for operational commands; for 'edit' commands, you have to use -e.
$ python3 panxapi.py -h my.firewall -K LUFRPT0yY2VpTWIzSjZQYUZEdzN4MHdoMXl0eFBKOUE9N29ZQ29HMndocmdLbjVJZWVkWWwrVFJPV0N6RmZVU1pJc1pjLzBnS2Fwdz0= -x -e '<disabled>yes</disabled>' "/config/devices/entry[@name='localhost.localdomain']/network/tunnel/ipsec/entry[@name='my-ipsec-tunnel']/disabled" edit: success [code="20"]: "command succeeded" <response code="20" status="success"><msg>command succeeded</msg></response>
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!