9.0 REST API - updating custom URL list unable to append

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

9.0 REST API - updating custom URL list unable to append

L0 Member

Hi Guys, 

 

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. 

 

However my problem is that my exisiting list gets overwritten whenever I attempt to add a new member to the list. 

 

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? 

 

url_add = '<entry name="allowed_urls" location="vsys" vsys="vsys1"><list><member>*.testwebsite.co.uk</member></list><type>URL List</type></entry>'

add_url = requests.put('https://172.22.99.12/restapi/9.0/Objects/CustomURLCategories?name=allowed_urls&action=set&location=vsys&vsys=vsys1&input-format=xml&output-format=xml&key='+cookie+' ', data=url_add, verify=False)

If i send the above, my current "allowed_urls" list gets overwritten and all urls replaced with *.testwebiste.co,uk

 

1 REPLY 1

L5 Sessionator

This is the expected behavior 🙂

 

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.

  • 2479 Views
  • 1 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!