Rest API not seeing template variables

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

Rest API not seeing template variables

L2 Linker

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:

Array 
@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

entry
Array of objects
 
Array 
@name
required
string <= 64 characters

Device serial number

variable
object
 
entry
Array of objects
 
Array 
@name
required
string <= 63 characters

Variables need to begin with '$'

type
required
1 accepted solution

Accepted Solutions

L5 Sessionator

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.

Help the community: "Like" helpful comments, and click "Accept as Solution" if you found your answer 🙂

View solution in original post

3 REPLIES 3

L5 Sessionator

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

Thanks for the feedback. I look forward to knowing what happened to the REST API access to the variables.

L5 Sessionator

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.

Help the community: "Like" helpful comments, and click "Accept as Solution" if you found your answer 🙂
  • 1 accepted solution
  • 3000 Views
  • 3 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!