API for checking if a specific rule is in disable or enable mode

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

API for checking if a specific rule is in disable or enable mode

L1 Bithead
 
1 ACCEPTED SOLUTION

Accepted Solutions

L5 Sessionator

Hi @itzikc, with the REST API the call would look something like this:

https://{{host}}/restapi/v10.0/Policies/SecurityRules?name={{rulename}}&location={{location}}&vsys={{vsys}}&output-format=json

And the response:

               },
                "action": "drop",
                "log-start": "yes",
                "log-setting": "default",
                "disabled": "yes"
            }
        ]
    }
}

 

 

With the XML API the call would look like this:

https://{{host}}/api/?key={{key}}&type=config&action=show&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='{{rulename}}']

And the response:

            <action>drop</action>
            <log-start>yes</log-start>
            <log-setting>default</log-setting>
            <disabled>yes</disabled>
        </entry>
    </result>
</response>

 

 

Modify as appropriate for you environment, specifically the API version for the REST API, and add Device Groups parameters if this is via Panorama.

Help the community: "Like" helpful comments, and click "Accept as Solution" if you found your answer 🙂

View solution in original post

2 REPLIES 2

L5 Sessionator

Hi @itzikc, with the REST API the call would look something like this:

https://{{host}}/restapi/v10.0/Policies/SecurityRules?name={{rulename}}&location={{location}}&vsys={{vsys}}&output-format=json

And the response:

               },
                "action": "drop",
                "log-start": "yes",
                "log-setting": "default",
                "disabled": "yes"
            }
        ]
    }
}

 

 

With the XML API the call would look like this:

https://{{host}}/api/?key={{key}}&type=config&action=show&xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='{{rulename}}']

And the response:

            <action>drop</action>
            <log-start>yes</log-start>
            <log-setting>default</log-setting>
            <disabled>yes</disabled>
        </entry>
    </result>
</response>

 

 

Modify as appropriate for you environment, specifically the API version for the REST API, and add Device Groups parameters if this is via Panorama.

Help the community: "Like" helpful comments, and click "Accept as Solution" if you found your answer 🙂

L1 Bithead

It works. Thank you.

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!