- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Content translations are temporarily unavailable due to site maintenance. We apologize for any inconvenience.
08-29-2023 11:43 PM - edited 08-29-2023 11:44 PM
Hello all. I'm trying to get started with some API work on my PAN OS. I walked through the Getting Started guide and I created a user, assigned an admin role to it that had API access, and then generated a key.
While I am using curl -k -X GET "https://a.b.c.d/api/?type=op&cmd=<show><system><info></info></system></show>&key=LUFRPT1.....cQ==" it shows <response status="success"> but while I am trying curl -k -X GET "https://a.b.c.d/api/?type=op&cmd=<request cmd="op" cookie="7671262853440057" uid="1004"><operations><show><virtual-wire>all</virtual-wire></show></operations></request>&key=LUFRPT1.....cQ==" it shows "<response status = 'error' code = '403'><result><msg>Invalid Credential</msg></result></response>" .
Even while I am trying to create address group facing the same issue.
09-02-2023 07:23 AM
Hi @ssovee ,
That's a good start! I have a couple of observations:
Thanks,
Tom
08-30-2023 10:12 PM
Hello @ssovee
You are using a cookie value in the curl request.
cookie="7671262853440057" uid="1004"
Can you remove this value and test the status?
09-02-2023 01:08 AM
Getting the same result....
curl -k -X GET "https://a.b.c.d/api/?type=op&cmd=<request cmd="op"><operations><show><virtual-wire>all</virtual-wire></show></operations></request>&key=L.................FqcQ=="
<response status = 'error' code = '403'><result><msg>Invalid Credential</msg></result></response>
09-02-2023 07:23 AM
Hi @ssovee ,
That's a good start! I have a couple of observations:
Thanks,
Tom
09-02-2023 08:21 AM
Hi,
It works for me. Thank you. I went through the document you shared.
I have created an address group and at the same time browse https://firewall/debug page. Then found the output below.
[2023/09/02 21:00:43] [44m panui_core\mgmt\MSConnection [0m (DEBUG) 5877532556119778 - -
socket 106 sending request <request cmd="complete" obj="/config/devices/entry[@name='localhost.localdomain']/vsys" cookie="5877532556119778"/>
[2023/09/02 21:00:43] [44m panui_core\mgmt\MSConnection [0m (DEBUG) 5877532556119778 - -
socket 106 response took 0.003s <response status="success" code="19">
<completions>
<completion value="vsys1" vxpath="/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']" current="yes"/>
</completions>
</response>
[02-Sep-2023 21:00:43 Asia/Dhaka] [2023/09/02 21:00:43] [41m panui_core\mgmt\MSConnection [0m (DEBUG) 5877532556119778 - -
socket 40 sending request <request cmd="set" obj="/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/address-group/entry[@name='01818090909']" cookie="5877532556119778" newonly="yes">
<dynamic>
<filter>"Ubuntu"</filter>
</dynamic>
</request>
[02-Sep-2023 21:00:43 Asia/Dhaka] [2023/09/02 21:00:43] [41m panui_core\mgmt\MSConnection [0m (DEBUG) 5877532556119778 - -
socket 40 response took 0.054s <response status="success" code="20">
<msg>command succeeded</msg>
</response>
Now I am trying to create an address group using the below command and it shows the Invalid credential msg again.
curl -k -X GET "https://a.b.c.d/api/?type=op&cmd=<request cmd="set" obj="/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/address-group/entry[@name='01819810810']"newonly="yes"><dynamic><filter>"Ubuntu"</filter></dynamic></request>&key=LUFRPT.............FqcQ=="
Maybe I am missing something. I would appreciate it if you could help me with this. Thanks in advance.
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!