REST API to update Panorama Servers in Firewall

Reply
L0 Member

REST API to update Panorama Servers in Firewall

Hi all

 

I wonder can anyone offer some insight, I am trying to write a script to update all of the panorama server settings on a given list of firewalls. That's all fine but I am having an issue with the actual rest api -

 

I used debug CLI output to determine the syntax in order to build the command and it looks right according to the guides I've read, however it doesnt' work. I am testing against a local VM running 7.1.

 

To test I am trying - (I've replaced my key below with key_removed and the IP addresses with x.x.x.x)

  

https://x.x.x.x/api/type=config&action=set&xpath=/config/devices/entry[@name='localhost.localdomain']/deviceconfig/system<panorama-server>x.x.x.x</panorama-server><panorama-server-2>x.x.x.x</panorama-server-2>&key=key_removed

 

It fails with the following -

 

<response status="error" code="13">
<msg>
<line>
Could not find schema node for xpath /config/devices/entry[@name='localhost.localdomain']/deviceconfig/system
<panorama-server>x.x.x.x</panorama-server>
<panorama-server-2>x.x.x.x</panorama-server-2>
</line>
</msg>
</response>
 
So I know something is wrong with the xpath, but I can't seem to figure out what.
 
Does anyone know what I am doing wrong ?
 
Thanks
James
 
Tags (2)
L0 Member

Re: REST API to update Panorama Servers in Firewall

Nevermind I found the issue, I needed to add &element= as per below - 

 

 

https://x.x.x.x/api/type=config&action=set&xpath=/config/devices/entry[@name='localhost.localdomain']/deviceconfig/system&element=<panorama-server>x.x.x.x</panorama-server><panorama-server-2>x.x.x.x</panorama-server-2>&key=key_removed

  

Hope this helps somebody else.

 

Regards
James

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!