- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
08-10-2017 02:13 AM
Hi,
I'm looking for the correct syntax to add a new managed device (serial number) into panorama, using API.
I tried lots of stuffs, but without success.
Does anybody can help me? or is it simply not supported?
Thx in advance,
Olivier
08-10-2017 09:39 AM
Good catch. Replacing that space with a %20 caused the command to succeed.
08-10-2017 06:24 AM
The call to add a firewall with serial number 12345 is:
/api/?type=config&action=set&xpath=/config/mgt-config/devices&element=<entry name="12345"/>
If you're curious how I ended up finding the syntax, I used Web UI Debug to look at the call that was done when I added the serial number.
https://live.paloaltonetworks.com/t5/Management-Articles/How-to-Run-a-PAN-OS-Web-UI-Debug/ta-p/58117
08-10-2017 06:46 AM
Hi,
I alreaydy tried this syntax, I got an error:
"a duplicate parameter was found in the argument string (name)"
I am pushing the API request from Ansible via a curl command.
If i do it from the shell directly, I got HTTP/1.1 404 Not Found
Have you tested it ?
I used WebUI, CLI debug and API Browser to search if I missed something:
WEBui;
<request cmd="add" obj="/config/mgt-config/devices" cookie="2012481505869557" target="panorama">
<entry name="111111111111111"/>
</request>
CLI:
<request cmd="set" obj="/config/mgt-config/devices" cookie="3769490762205842"><entry name='111111111111111'/></request>
cmd action is different, but both work. Only from API I cannot get it working 😞
08-10-2017 06:48 AM
Did you try the API call I provided? I verified that worked on my firewall.
08-10-2017 06:48 AM
Can you provide the API call that you're using, minus the key and IP address?
08-10-2017 06:53 AM
I use this API call:
curl -k -v "https://<panorama_ip>/api/?type=config&action=set&key=<my_key>&xpath=/config/mgt-config/devices&element=<entry name='111111111111111'/>"
08-10-2017 07:08 AM
Interesting. I was testing previously using the browser, which worked fine. Curl does not work for this command for me, however. It returns a 404 error. I also tried the python requests library, which does work as well.
Are you also seeing a 404 returned?
08-10-2017 07:58 AM
Yes: I got HTTP/1.1 404 Not Found
Sounds like cURL is not sending it correctly 😕
maybe because of the space between entry and name ??? wrong encoding?
08-10-2017 09:39 AM
Good catch. Replacing that space with a %20 caused the command to succeed.
08-10-2017 11:42 PM
response status=\"success\" !!
yes !! %20 did it. Thanks a lot for your help !! I can continue to script crazy stuffs 🙂
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!