Cannot update a custom URL category via the XML/API

Reply
L1 Bithead

Cannot update a custom URL category via the XML/API

Hi, 

 

I'm trying to populate an existing custom URL category... My query is the following:

 

https://x.x.x.x/api/?type=config&key=xxxx&action=set&xpath=/config/devices/entry/vsys/entry[@name="v...

 

The result is:

 

<response status="error" code="13">
<msg>
<line>
set failed, may need to override template object first
</line>
</msg>
</response>
 
I already read other people's port about the same error but no solution was available... Any error in the URL?
 
KR,
/x
Highlighted
L1 Bithead

Re: Cannot update a custom URL category via the XML/API

Hi Xavier,

 

Try the following:

 

https://x.x.x.x/api/?type=config&action=set&key=KeyValue&xpath=/config/devices/entry/vsys/entry[@name='vsys1']/profiles/custom-url-category/entry[@name='my_malicious_urls']/list&element=<member>www.google.com</member>

 

 

Where host & keyvalue input needed appropriately. 

L1 Bithead

Re: Cannot update a custom URL category via the XML/API

Tx for the example. It works ok now!

 

/x

L1 Bithead

Re: Cannot update a custom URL category via the XML/API

Here is another example using curl if you see encoding errors

 

curl -k -d key=$KEY --data-urlencode "xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/profiles/custom-url-category/entry[@name='my_malicious_domains']/list" -d 'type=config' -d 'action=set' --data-urlencode "element=<member>http://www.maliciousdomain.com</member>" https://x.x.x.x/api/

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 Live Community as a whole!

The Live Community thanks you for your participation!