<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: API calls to add managed device to panorama template and override variables. in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-calls-to-add-managed-device-to-panorama-template-and/m-p/245256#M1832</link>
    <description>&lt;P&gt;I'm doing override as the varibale already exists in the template.&lt;/P&gt;&lt;P&gt;I just fixed it, here is the API call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;https://panorama/api/?type=config&amp;amp;action=set&amp;amp;key=my_key&amp;amp;xpath=/config/devices/entry[@name='localhost.localdomain']/template-stack/entry[@name='TEST']/devices/entry[@name='1111111111']/variable&amp;amp;element=&amp;lt;entry name='$Variable1'&amp;gt;&amp;lt;type&amp;gt;&amp;lt;ip-netmask&amp;gt;10.10.10.0/24&amp;lt;/ip-netmask&amp;gt;&amp;lt;/type&amp;gt;&amp;lt;/entry&amp;gt;"

&lt;/PRE&gt;&lt;P&gt;I did use Postman to do get call as curl tends to have issues with spaces and special characters.&lt;/P&gt;</description>
    <pubDate>Tue, 08 Jan 2019 17:53:48 GMT</pubDate>
    <dc:creator>Dinko</dc:creator>
    <dc:date>2019-01-08T17:53:48Z</dc:date>
    <item>
      <title>API calls to add managed device to panorama template and override variables.</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-calls-to-add-managed-device-to-panorama-template-and/m-p/244583#M1828</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been trying to tailor two API calls for adding managed device to a template in panorama and override template variable for for the specific device.&lt;/P&gt;&lt;P&gt;Looking at the API browser I get the following which throws error message with curl.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Add device to template stack&lt;/P&gt;&lt;PRE&gt;curl -k -X GET "https://&amp;lt;panorama&amp;gt;/api/?type=op&amp;amp;key=&amp;lt;my_key&amp;gt;=&amp;amp;xpath=/config/devices/entry[@name='localhost.localdomain']/template-stack/entry[@name='test-template']/devices/entry[@name='111111111111111']/&amp;gt;"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#Override variabes for specific device&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;curl -k -X GET "https://&amp;lt;panorama&amp;gt;/api/?type=config&amp;amp;action=get&amp;amp;xpath=/config/devices/entry[@name='localhost.localdomain']/template-stack/entry[@name='test-template']/devices/entry[@name='111111111111111']/variable" cookie="1234567890" override="yes"&amp;gt;&amp;lt;entry name="$subnet"&amp;gt;&amp;lt;type&amp;gt;&amp;lt;ip-netmask&amp;gt;192.168.1.0/24&amp;lt;/ip-netmask&amp;gt;&amp;lt;/type&amp;gt;&amp;lt;/entry&amp;gt;&amp;lt;/request&amp;gt;"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was hoping that some one can point me in the right direction on how the API should look like.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Dec 2018 18:32:50 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-calls-to-add-managed-device-to-panorama-template-and/m-p/244583#M1828</guid>
      <dc:creator>Dinko</dc:creator>
      <dc:date>2018-12-28T18:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: API calls to add managed device to panorama template and override variables.</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-calls-to-add-managed-device-to-panorama-template-and/m-p/245153#M1830</link>
      <description>&lt;P&gt;Figured the first part:&lt;/P&gt;&lt;P&gt;curl -k -g "https://panorama/api/?type=config&amp;amp;action=set&amp;amp;key=my_key/config/devices/entry[@name='localhost.localdomain']/template-stack/entry[@name='TEST']/devices&amp;amp;element=&amp;lt;entry%20name='111111111111111'/&amp;gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Still batling with how to override the variable:&lt;/P&gt;&lt;P&gt;Here is what I'm using for xpath:&lt;/P&gt;&lt;P&gt;xpath=/config/devices/entry[@name='localhost.localdomain']/template-stack/entry[@name='TEST']/devices/entry[@name='111111111111111']/variable/entry[@name='$Variable1']/type/ip-netmask&amp;amp;element=&amp;lt;member name='10.10.10.0/24'/&amp;gt;"&lt;/P&gt;&lt;P&gt;I'm getting "bad xpath"&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 21:48:21 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-calls-to-add-managed-device-to-panorama-template-and/m-p/245153#M1830</guid>
      <dc:creator>Dinko</dc:creator>
      <dc:date>2019-01-07T21:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: API calls to add managed device to panorama template and override variables.</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-calls-to-add-managed-device-to-panorama-template-and/m-p/245251#M1831</link>
      <description>&lt;P&gt;If you're doing a &lt;CODE&gt;set&lt;/CODE&gt; because &lt;CODE&gt;$Variable1&lt;/CODE&gt; doesn't already exist, then this should be what you do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;type=config&lt;/P&gt;
&lt;P&gt;action=set&lt;/P&gt;
&lt;P&gt;key=(your_key_here)&lt;/P&gt;
&lt;P&gt;xpath=/config/devices/entry[@name='localhost.localdomain']/template-stack/entry[@name='(your_name_here)']/variable&lt;/P&gt;
&lt;P&gt;element=&amp;lt;entry name='$Variable1'&amp;gt;&amp;lt;type&amp;gt;&amp;lt;ip-netmask&amp;gt;10.10.10.0/24&amp;lt;/ip-netmask&amp;gt;&amp;lt;/type&amp;gt;&amp;lt;/entry&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the variable &lt;CODE&gt;$Variable1&lt;/CODE&gt; already exists, you'll want to do an EDIT instead of SET.&amp;nbsp; So in the above:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) &lt;CODE&gt;action&lt;/CODE&gt; should be &lt;CODE&gt;edit&lt;/CODE&gt; instead of &lt;CODE&gt;set&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;2) xpath should have the following added on to the end:&amp;nbsp; &lt;CODE&gt;/entry[@name='$Variable1']&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That should do it I think.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 16:30:31 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-calls-to-add-managed-device-to-panorama-template-and/m-p/245251#M1831</guid>
      <dc:creator>gfreeman</dc:creator>
      <dc:date>2019-01-08T16:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: API calls to add managed device to panorama template and override variables.</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-calls-to-add-managed-device-to-panorama-template-and/m-p/245256#M1832</link>
      <description>&lt;P&gt;I'm doing override as the varibale already exists in the template.&lt;/P&gt;&lt;P&gt;I just fixed it, here is the API call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;https://panorama/api/?type=config&amp;amp;action=set&amp;amp;key=my_key&amp;amp;xpath=/config/devices/entry[@name='localhost.localdomain']/template-stack/entry[@name='TEST']/devices/entry[@name='1111111111']/variable&amp;amp;element=&amp;lt;entry name='$Variable1'&amp;gt;&amp;lt;type&amp;gt;&amp;lt;ip-netmask&amp;gt;10.10.10.0/24&amp;lt;/ip-netmask&amp;gt;&amp;lt;/type&amp;gt;&amp;lt;/entry&amp;gt;"

&lt;/PRE&gt;&lt;P&gt;I did use Postman to do get call as curl tends to have issues with spaces and special characters.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 17:53:48 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-calls-to-add-managed-device-to-panorama-template-and/m-p/245256#M1832</guid>
      <dc:creator>Dinko</dc:creator>
      <dc:date>2019-01-08T17:53:48Z</dc:date>
    </item>
  </channel>
</rss>

