<?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 Dynamic Tags via XML API with CIDR Range in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/dynamic-tags-via-xml-api-with-cidr-range/m-p/195318#M1537</link>
    <description>&lt;P&gt;&amp;nbsp;So the problem I'm running into is that its simple to interact with the XML API, but its not always so easy to figure out where the commands are or how they should be formatted. You guys should really consider some OpenAPI 3 style documentation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have a tag associated with policy that when I tag an API it applies the policy to the address being tagged. Its worked great one IP at a time, but for this use case I need to be able to tag CIDR or at very least address range.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the (python) payload looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;payload = { 'type': 'user-id', 'vsys': 'vsys1', 'cmd':'&amp;lt;uid-message&amp;gt; &amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt; &amp;lt;type&amp;gt;update&amp;lt;/type&amp;gt; &amp;lt;payload&amp;gt; &amp;lt;register&amp;gt; &amp;lt;entry ip="192.168.1.1"&amp;gt; &amp;lt;tag&amp;gt; &amp;lt;member&amp;gt;Development&amp;lt;/member&amp;gt; &amp;lt;/tag&amp;gt; &amp;lt;/entry&amp;gt; &amp;lt;/register&amp;gt; &amp;lt;/payload&amp;gt; &amp;lt;/uid-message&amp;gt;', 'key': apikey}&lt;/PRE&gt;&lt;P&gt;and iut works great for single targeted IP addresses, but it wont take CIDR with the entry IP xml tag. It was suggested I try using the debug console to find the specific XML that the web console uses and I found it, but its doing it completely differently from the documentation and the method its using is undocumented.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;request cmd='op' cookie='######' vsys='vsys1' target-vsys='vsys1'&amp;gt;&lt;BR /&gt;&amp;lt;operations xml='yes'&amp;gt;&amp;lt;set&amp;gt;&amp;lt;user-id&amp;gt;&amp;lt;data&amp;gt;&amp;lt;![CDATA[&amp;lt;uid-message&amp;gt; &amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt; &lt;BR /&gt;&amp;lt;type&amp;gt;update&amp;lt;/type&amp;gt; &amp;lt;payload&amp;gt; &amp;lt;register&amp;gt; &amp;lt;ip-netmask&amp;gt;1.1.1.1/24&amp;lt;/ip-netmask&amp;gt; &lt;BR /&gt;&amp;lt;tag&amp;gt; &amp;lt;member&amp;gt;Development&amp;lt;/member&amp;gt; &amp;lt;/tag&amp;gt; &amp;lt;/entry&amp;gt; &amp;lt;/register&amp;gt; &amp;lt;/payload&amp;gt; &amp;lt;/uid-message&amp;gt;
]]&amp;gt;&amp;lt;/data&amp;gt;&amp;lt;/user-id&amp;gt;&amp;lt;/set&amp;gt;&amp;lt;/operations&amp;gt;&amp;lt;/request&amp;gt;&lt;/PRE&gt;&lt;P&gt;Im not positive how that equates to the working payload, but I tried a few iterations and it never seemed to be happy. I DID get the system to think it accepted the CIDR IP when I used this formatting&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;'&amp;lt;uid-message&amp;gt; &amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt; &amp;lt;type&amp;gt;update&amp;lt;/type&amp;gt; &amp;lt;payload&amp;gt; &amp;lt;register&amp;gt; &amp;lt;entry ip-netmask="192.168.5.112/31"&amp;gt; &amp;lt;tag&amp;gt; &amp;lt;member&amp;gt;SOCDevelopment&amp;lt;/member&amp;gt; &amp;lt;/tag&amp;gt; &amp;lt;/entry&amp;gt; &amp;lt;/register&amp;gt; &amp;lt;/payload&amp;gt; &amp;lt;/uid-message&amp;gt;'&lt;/PRE&gt;&lt;P&gt;but then it was super confused in the CLI, reporting the IP address as just " :: # "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;gt;show object registered-ip tag SOCDevelopment&lt;BR /&gt;
registered IP Tags
:: #
"Development"
Total: 1 registered addresses&lt;/PRE&gt;&lt;P&gt;Thoughts or ideas would be great &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jan 2018 15:44:03 GMT</pubDate>
    <dc:creator>hallerr</dc:creator>
    <dc:date>2018-01-16T15:44:03Z</dc:date>
    <item>
      <title>Dynamic Tags via XML API with CIDR Range</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/dynamic-tags-via-xml-api-with-cidr-range/m-p/195318#M1537</link>
      <description>&lt;P&gt;&amp;nbsp;So the problem I'm running into is that its simple to interact with the XML API, but its not always so easy to figure out where the commands are or how they should be formatted. You guys should really consider some OpenAPI 3 style documentation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have a tag associated with policy that when I tag an API it applies the policy to the address being tagged. Its worked great one IP at a time, but for this use case I need to be able to tag CIDR or at very least address range.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the (python) payload looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;payload = { 'type': 'user-id', 'vsys': 'vsys1', 'cmd':'&amp;lt;uid-message&amp;gt; &amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt; &amp;lt;type&amp;gt;update&amp;lt;/type&amp;gt; &amp;lt;payload&amp;gt; &amp;lt;register&amp;gt; &amp;lt;entry ip="192.168.1.1"&amp;gt; &amp;lt;tag&amp;gt; &amp;lt;member&amp;gt;Development&amp;lt;/member&amp;gt; &amp;lt;/tag&amp;gt; &amp;lt;/entry&amp;gt; &amp;lt;/register&amp;gt; &amp;lt;/payload&amp;gt; &amp;lt;/uid-message&amp;gt;', 'key': apikey}&lt;/PRE&gt;&lt;P&gt;and iut works great for single targeted IP addresses, but it wont take CIDR with the entry IP xml tag. It was suggested I try using the debug console to find the specific XML that the web console uses and I found it, but its doing it completely differently from the documentation and the method its using is undocumented.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;request cmd='op' cookie='######' vsys='vsys1' target-vsys='vsys1'&amp;gt;&lt;BR /&gt;&amp;lt;operations xml='yes'&amp;gt;&amp;lt;set&amp;gt;&amp;lt;user-id&amp;gt;&amp;lt;data&amp;gt;&amp;lt;![CDATA[&amp;lt;uid-message&amp;gt; &amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt; &lt;BR /&gt;&amp;lt;type&amp;gt;update&amp;lt;/type&amp;gt; &amp;lt;payload&amp;gt; &amp;lt;register&amp;gt; &amp;lt;ip-netmask&amp;gt;1.1.1.1/24&amp;lt;/ip-netmask&amp;gt; &lt;BR /&gt;&amp;lt;tag&amp;gt; &amp;lt;member&amp;gt;Development&amp;lt;/member&amp;gt; &amp;lt;/tag&amp;gt; &amp;lt;/entry&amp;gt; &amp;lt;/register&amp;gt; &amp;lt;/payload&amp;gt; &amp;lt;/uid-message&amp;gt;
]]&amp;gt;&amp;lt;/data&amp;gt;&amp;lt;/user-id&amp;gt;&amp;lt;/set&amp;gt;&amp;lt;/operations&amp;gt;&amp;lt;/request&amp;gt;&lt;/PRE&gt;&lt;P&gt;Im not positive how that equates to the working payload, but I tried a few iterations and it never seemed to be happy. I DID get the system to think it accepted the CIDR IP when I used this formatting&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;'&amp;lt;uid-message&amp;gt; &amp;lt;version&amp;gt;1.0&amp;lt;/version&amp;gt; &amp;lt;type&amp;gt;update&amp;lt;/type&amp;gt; &amp;lt;payload&amp;gt; &amp;lt;register&amp;gt; &amp;lt;entry ip-netmask="192.168.5.112/31"&amp;gt; &amp;lt;tag&amp;gt; &amp;lt;member&amp;gt;SOCDevelopment&amp;lt;/member&amp;gt; &amp;lt;/tag&amp;gt; &amp;lt;/entry&amp;gt; &amp;lt;/register&amp;gt; &amp;lt;/payload&amp;gt; &amp;lt;/uid-message&amp;gt;'&lt;/PRE&gt;&lt;P&gt;but then it was super confused in the CLI, reporting the IP address as just " :: # "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;gt;show object registered-ip tag SOCDevelopment&lt;BR /&gt;
registered IP Tags
:: #
"Development"
Total: 1 registered addresses&lt;/PRE&gt;&lt;P&gt;Thoughts or ideas would be great &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 15:44:03 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/dynamic-tags-via-xml-api-with-cidr-range/m-p/195318#M1537</guid>
      <dc:creator>hallerr</dc:creator>
      <dc:date>2018-01-16T15:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Tags via XML API with CIDR Range</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/dynamic-tags-via-xml-api-with-cidr-range/m-p/195340#M1538</link>
      <description>&lt;P&gt;&lt;A href="https://live.paloaltonetworks.com/t5/Featured-Articles/Tips-amp-Tricks-API-configuration/ta-p/72917" target="_blank"&gt;https://live.paloaltonetworks.com/t5/Featured-Articles/Tips-amp-Tricks-API-configuration/ta-p/72917&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is helping a lot, pretty sure im getting closer to the right command/xml set&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2018 16:53:31 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/dynamic-tags-via-xml-api-with-cidr-range/m-p/195340#M1538</guid>
      <dc:creator>hallerr</dc:creator>
      <dc:date>2018-01-16T16:53:31Z</dc:date>
    </item>
  </channel>
</rss>

