API: add a managed device into panorama

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API: add a managed device into panorama

L1 Bithead

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

1 accepted solution

Accepted Solutions

Good catch. Replacing that space with a %20 caused the command to succeed.

View solution in original post

9 REPLIES 9

L4 Transporter

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

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 😞

 

Did you try the API call I provided? I verified that worked on my firewall.

Can you provide the API call that you're using, minus the key and IP address?

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'/>"

 

 

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?

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?

Good catch. Replacing that space with a %20 caused the command to succeed.

response status=\"success\" !!

 

yes !! %20 did it. Thanks a lot for your help !! I can continue to script crazy stuffs 🙂

 

  • 1 accepted solution
  • 6208 Views
  • 9 replies
  • 1 Likes
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 LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!