- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
05-25-2012 03:22 PM
I am trying to delete a specific custom-url-category list member using the XML API. The system either responds with an object not found error or it deletes all members in the list.
This is what I get when i show lists:
<response status="success" code="19"><result total-count="1" count="1"><list admin="admin" time="2012/05/25 21:59:11"><member admin="admin" time="2012/05/25 21:59:04">www.somesite.com</member><member admin="admin" time="2012/05/25 21:59:11">chris.com</member></list></result></response>
Here is the command that I am using that deletes all records:
wget "https://x.x.x.x/api/?type=config&action=delete&key=key&xpath=/config/devices/entry/vsys/entry[@name='vsys1']/profiles/custom-url-category/entry[@name='CIRT_Blocks']/list&element=<member>chris.com</member>" --no-check-certificate -O response.txt
This command returns not found:
wget "https://x.x.x.x/api/?type=config&action=delete&key=key&xpath=/config/devices/entry/vsys/entry[@name='vsys1']/profiles/custom-url-category/entry[@name='CIRT_Blocks']/list/member['chris.com']" --no-check-certificate -O response.txt
or
wget "https://x.x.x.x/api/?type=config&action=delete&key=key&xpath=/config/devices/entry/vsys/entry[@name='vsys1']/profiles/custom-url-category/entry[@name='CIRT_Blocks']/list[@member='chris.com']" --no-check-certificate -O response.txt
How do I delete a single member from the list?
Thanks,
Matt
05-25-2012 04:53 PM
[didn't like my reply with mutt; try again, this time with webui]
you want to use the XPath text() function, for example:
$ panxapi -t pa-200 -d "/config/devices/entry/vsys/entry/profiles/custom-url-category/entry[@name='t1']/list/member[text()='chris.com']"
delete: success: command succeeded
Message was edited by: ksteves
05-25-2012 04:53 PM
[didn't like my reply with mutt; try again, this time with webui]
you want to use the XPath text() function, for example:
$ panxapi -t pa-200 -d "/config/devices/entry/vsys/entry/profiles/custom-url-category/entry[@name='t1']/list/member[text()='chris.com']"
delete: success: command succeeded
Message was edited by: ksteves
02-26-2013 03:08 PM
how about deleting multiple URL's at the same time?
I'd like to do something where I dynamically update a custom url category. I'm currently thinking on 2 calls to the API - one to add URL's that need to be added, the other to delete the ones that need to be deleted. I can currently populate a list with the following options:
{'action': 'set',
'xpath': "/config/shared/profiles/custom-url-category/entry[@name='test']/list",
'type': 'config',
'key': 'RANDOM-LETTERS',
'element': '<member>www.apitest1.com</member><member>www.apitest2.com</member><member>www.apitest3.com</member>'}
if I change the action from 'set' to 'delete', and element to 'element': '<member>www.apitest3.com</member>' it whacks the whole custom category
If I change the action from 'set' to 'edit' (and use the same element as above - only www.apitest3.com) I get the following error:
<response status="error" code="12"><msg><line>Edit breaks config validity</line></msg></response>
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!