Disable rule using XML API 5.0

Reply
L2 Linker

Disable rule using XML API 5.0

Dear alll,

I am trying to disable a specific rule from the security policy using the XML api...

I am sending the following URL:

https://192.168.1.1/api/?type=config&action=edit&key=<my_key_here>=&xpath=/config/devices/entry/vsys/entry/rulebase/security/rules/entry[@name='rule1']&element=<disabled>yes</disabled>

But as a result I get the following error:

<response status="error" code="12"><msg><line>Edit breaks config validity</line></msg></response>

What am I doing wrong?

George

Tags (1)
L0 Member

Re: Disable rule using XML API 5.0

Try changing the action to "action=set", rather than edit.

L3 Networker

Re: Disable rule using XML API 5.0

edit wants an xpath node which 'overlaps' with the element (XML) data, so add '/disabled' at the end of your xpath.

Not applicable
L6 Presenter

Re: Disable rule using XML API 5.0

I tried this last one worked.

Thanks for useful command.I also wonder how debug commands can be used by Api (or if we can)

SRA
L4 Transporter

Re: Disable rule using XML API 5.0

Debug commands are not supported by the 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!