Add rule to ruleset
Adds a single rule to an existing ruleset. Use this endpoint to add a rule without having to include all the existing ruleset rules in the request.
Use one of the following API endpoints:
Operation | Method + Endpoint |
---|---|
Create account ruleset rule | POST /accounts/<ACCOUNT_ID>/rulesets/<RULESET_ID>/rules |
Create zone ruleset rule | POST /zones/<ZONE_ID>/rulesets/<RULESET_ID>/rules |
Include the rule definition in the request body.
By default, the rule will be added to the end of the existing list of rules in the ruleset. To define a specific position for the rule, include a position
object in the request body according to the guidelines in Change the order of a rule in a ruleset.
Invoking this method creates a new version of the ruleset.
Example
The following example adds a rule to ruleset <RULESET_ID>
of zone <ZONE_ID>
. The ruleset ID was previously obtained using the List zone rulesets operation, and corresponds to the entry point ruleset for the http_request_firewall_custom
phase.Request
The response includes the complete ruleset after adding the rule.Response