Enhanced Security Measures in Place:   To ensure a safer experience, we’ve implemented additional, temporary security measures for all users.

Template Stack variable assignments via API

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

Template Stack variable assignments via API

L2 Linker

Greetings,

 

I use Template Stacks with variables a lot for firewalls with the same hardware and network settings.

To assign the value of a variable, I go to the template stack and export the variable CSV file. I modify the file with the values for my firewall and import the CSV file.

This is all good, but I would like to automate this via API.

Via the API I can add new variables to my Templates, but this is not what I want to do. I want to add the values to the variables for the NGFW devices assigned to the Template Stack.

I just can't figure out how to add values to the devices in my templates.

I would even be ok with exporting the variable CSV via API, have my script modify the CSV, (add the values in the appropriate sections), and then import the CSV via API, but once again, I can't find where you can export the variables CSV. I can export all kinds of other items, but not this.

I am doing my scripting in python with the pandevice module.

Thanks.

2 REPLIES 2

L0 Member

any update to this? 

Hi @mrzepa2 @grchew,

Does this help, for the example of a variable which is an IP address?

https://{{host}}/api/?key={{key}}&type=config&action=set&xpath=/config/devices/entry[@name='localhost.localdomain']/template-stack/entry[@name='{{template-stack-name}}']/devices/entry[@name='{{serial-number}}']/variable&element=<entry name="{{var-name}}"><type><ip-netmask>{{object-ip-1}}</ip-netmask></type></entry>

 

Help the community: "Like" helpful comments, and click "Accept as Solution" if you found your answer 🙂
  • 3648 Views
  • 2 replies
  • 0 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!