Custom-url-category using XML API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

Custom-url-category using XML API

L0 Member

I am almost there as to trying to add a custom url category its just that I can't add it correctly. The below works perfectly and can go ahead and return a custom url category so I know at least my API Key is good and I can authenticate fine with Panorama and I get a Success code of '19'.

 

Get_URL = "https://<panorama-url>/api/?type=config&action=get&xpath=/config/shared/profiles/custom-url-category/entry[@name='github']"
response = requests.get(f'{Get_URL}&key={API_Token}', verify = f'{Root_CA}')
 
 
My issue is with the below is that when I try add a new object, then I get a Error Code 12 (Invalid object) which indicates that my "Xpath or element values provided are not complete."
 
Set_URL = 'https://<panorama-url>/api/?type=config&action=set&xpath=/config/shared/profiles/custom-url-category/entry[@name="TEST1"]/list&<entry name="TEST1"><list><member>*.TEST1.com</member><member>TEST1.com</member></list><type>URL List</type><description>TEST1</description></entry>'
response = requests.post(f'{Set_URL}&key={API_Token}'verify = f'{Root_CA}')
 
 
I have also tried messing with the URL to create just the object without any information and that fails as well. When I use the WebUI, it DOES allow me to just create a custom URL object with using only the name so this should work but I get same Error code 12 (I tried put,post, and get). I also tried adding "/list" to the end of the URL and got same error code.
 
URL = "https://<panorama-url>/api/?type=config&action=set&xpath=/config/shared/profiles/custom-url-category/entry[@name='TEST1']"
response = requests.post(f'{URL}&key={API_Token}'verify = f'{Root_CA}')
 
 Does anyone see what I am doing wrong for the URL that I can change to make this work?

 

1 accepted solution

Accepted Solutions

L0 Member

Figured it out by a ton of trial and error and the below will work just fine to create a new url category:

 

Add_custom_url_category = "https://<panorama-url>/api/?type=config&action=set&xpath=/config/shared/profiles/custom-url-category/entry[@name='TEST1']&element=<list><member>*.github.com</member><member>github.com</member></list><type>URL List</type>"

View solution in original post

1 REPLY 1

L0 Member

Figured it out by a ton of trial and error and the below will work just fine to create a new url category:

 

Add_custom_url_category = "https://<panorama-url>/api/?type=config&action=set&xpath=/config/shared/profiles/custom-url-category/entry[@name='TEST1']&element=<list><member>*.github.com</member><member>github.com</member></list><type>URL List</type>"
  • 1 accepted solution
  • 2662 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!