- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
10-30-2022 08:47 AM
I'm trying to use the REST API to get/set variables on the template stack.
According to the restapi-doc for PANOS 10.1, under the "devices" object, there is an "entry" object which has an Array of objects that contain 2 more objects, the first being "@name" which is the serial number and the second being "variable" which is an object that contains an "entry" and an Array of objects repressing the variable (name, type and value).
When I do my get call, all the info is returned except the "variable" object.
[{'@name': 'sample_Stack',
'description': 'sample description',
'devices': {'entry': [{'@name': '0128001123456'}]},
'templates': {'member': ['sample1',
'sample2',
'sample3']}}]
Anyone else try this and gotten it to work?
From the restapi-doc:
@name required | string <object-name> <= 63 characters Alphanumeric string [ 0-9a-zA-Z._-] | |||||||||||||
description | string <= 255 characters Description of template stack | |||||||||||||
devices | object Device serial numbers | |||||||||||||
|
08-09-2023 02:59 AM - edited 09-28-2023 04:27 AM
FYI: This was fixed in 11.0.2, I just tested successfully on 11.0.2 Panorama. The fix for 10.2 is currently due to be released in 10.2.8 but check release notes in future 10.2.x releases for full confirmation.
10-31-2022 06:44 AM
Hi @mrzepa2,
I get the same behaviour, I will investigate further.
Meantime, you can use the XML API, for example:
https://{{host}}/api/?key={{key}}&type=config&action=show&xpath=/config/devices/entry[@name='localhost.localdomain']/template-stack/entry[@name='{{template-stack-name}}']/devices/entry[@name='{{lab-vm1-serial}}']/variable
<response status="success">
<result>
<variable>
<entry name="$mgmt-ip">
<type>
<ip-netmask>192.168.1.6</ip-netmask>
</type>
</entry>
<entry name="$ha-priority">
<type>
<device-priority>90</device-priority>
</type>
</entry>
<entry name="$ha1-peer">
<type>
<ip-netmask>192.168.1.7</ip-netmask>
</type>
</entry>
</variable>
</result>
</response>
11-02-2022 08:18 AM
Thanks for the feedback. I look forward to knowing what happened to the REST API access to the variables.
08-09-2023 02:59 AM - edited 09-28-2023 04:27 AM
FYI: This was fixed in 11.0.2, I just tested successfully on 11.0.2 Panorama. The fix for 10.2 is currently due to be released in 10.2.8 but check release notes in future 10.2.x releases for full confirmation.
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!