<?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 9.0 REST API - updating custom URL list unable to append in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/9-0-rest-api-updating-custom-url-list-unable-to-append/m-p/289094#M2035</link>
    <description>&lt;P&gt;Hi Guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First post on this forum - relitivly new to PAN however I am looking to automate the addition of new URLs to a custom URL catagory we have called "allowed_urls" - I figured I can do this via the RESI API - using the put method, I am using the requests library in python to achieve this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However my problem is that my exisiting list gets overwritten whenever I attempt to add a new member to the list.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find my code below - apologies as this is my first venture into PAN and the PAN API world - is what I am doing possible?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;url_add = &lt;SPAN&gt;'&amp;lt;entry name="allowed_urls" location="vsys" vsys="vsys1"&amp;gt;&amp;lt;list&amp;gt;&amp;lt;member&amp;gt;*.testwebsite.co.uk&amp;lt;/member&amp;gt;&amp;lt;/list&amp;gt;&amp;lt;type&amp;gt;URL List&amp;lt;/type&amp;gt;&amp;lt;/entry&amp;gt;'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;add_url = requests.put(&lt;SPAN&gt;'https://172.22.99.12/restapi/9.0/Objects/CustomURLCategories?name=allowed_urls&amp;amp;action=set&amp;amp;location=vsys&amp;amp;vsys=vsys1&amp;amp;input-format=xml&amp;amp;output-format=xml&amp;amp;key='&lt;/SPAN&gt;+cookie+&lt;SPAN&gt;' '&lt;/SPAN&gt;, &lt;SPAN&gt;data&lt;/SPAN&gt;=url_add, &lt;SPAN&gt;verify&lt;/SPAN&gt;=&lt;SPAN&gt;False&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;If i send the above, my current "allowed_urls" list gets overwritten and all urls replaced with *.testwebiste.co,uk&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Sep 2019 10:59:10 GMT</pubDate>
    <dc:creator>craig_cartlidge</dc:creator>
    <dc:date>2019-09-19T10:59:10Z</dc:date>
    <item>
      <title>9.0 REST API - updating custom URL list unable to append</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/9-0-rest-api-updating-custom-url-list-unable-to-append/m-p/289094#M2035</link>
      <description>&lt;P&gt;Hi Guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First post on this forum - relitivly new to PAN however I am looking to automate the addition of new URLs to a custom URL catagory we have called "allowed_urls" - I figured I can do this via the RESI API - using the put method, I am using the requests library in python to achieve this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However my problem is that my exisiting list gets overwritten whenever I attempt to add a new member to the list.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find my code below - apologies as this is my first venture into PAN and the PAN API world - is what I am doing possible?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;url_add = &lt;SPAN&gt;'&amp;lt;entry name="allowed_urls" location="vsys" vsys="vsys1"&amp;gt;&amp;lt;list&amp;gt;&amp;lt;member&amp;gt;*.testwebsite.co.uk&amp;lt;/member&amp;gt;&amp;lt;/list&amp;gt;&amp;lt;type&amp;gt;URL List&amp;lt;/type&amp;gt;&amp;lt;/entry&amp;gt;'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;add_url = requests.put(&lt;SPAN&gt;'https://172.22.99.12/restapi/9.0/Objects/CustomURLCategories?name=allowed_urls&amp;amp;action=set&amp;amp;location=vsys&amp;amp;vsys=vsys1&amp;amp;input-format=xml&amp;amp;output-format=xml&amp;amp;key='&lt;/SPAN&gt;+cookie+&lt;SPAN&gt;' '&lt;/SPAN&gt;, &lt;SPAN&gt;data&lt;/SPAN&gt;=url_add, &lt;SPAN&gt;verify&lt;/SPAN&gt;=&lt;SPAN&gt;False&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;If i send the above, my current "allowed_urls" list gets overwritten and all urls replaced with *.testwebiste.co,uk&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 10:59:10 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/9-0-rest-api-updating-custom-url-list-unable-to-append/m-p/289094#M2035</guid>
      <dc:creator>craig_cartlidge</dc:creator>
      <dc:date>2019-09-19T10:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: 9.0 REST API - updating custom URL list unable to append</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/9-0-rest-api-updating-custom-url-list-unable-to-append/m-p/292368#M2044</link>
      <description>&lt;P&gt;This is the expected behavior &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to add a URL then do a GET to get the current config, then add in the new URL(s), then do the put with the combined information.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 15:59:26 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/9-0-rest-api-updating-custom-url-list-unable-to-append/m-p/292368#M2044</guid>
      <dc:creator>gfreeman</dc:creator>
      <dc:date>2019-10-10T15:59:26Z</dc:date>
    </item>
  </channel>
</rss>

