The documentation I linked contains
The documentation I linked contains links to the relevant API endpoint documentations
5 Replies
https://api.cloudflare.com/client/v4/zones/{zone_id}/rulesets/{ruleset_id}/rules
Erisa I think I need to have rulesets id to create a rate limit rule, right?
Yes, this is covered on https://developers.cloudflare.com/waf/rate-limiting-rules/create-api/
Point 1
Invoke the List zone rulesets method to obtain the list of rulesets in your zone. You will need the zone ID for this operation.It then covers in points 2 and 3 what to do if there is a ruleset and if there is not
Yes there are ruleset ids created by cloudflare
Can I create a rate limit rule using the id information of any of these listed rule sets I sent you?
No, please follow point 2 on https://developers.cloudflare.com/waf/rate-limiting-rules/create-api/
Search for an entry point ruleset for thehttp_ratelimit
phase in the response. Such a ruleset would have the following properties:"kind": "zone"
and"phase": "http_ratelimit"
.
AH okey
CURLOPT_POSTFIELDS => "{\n \"description\": \"My ruleset to execute managed rulesets\",\n \"kind\": \"zone\",\n \"name\": \"My ruleset\",\n \"phase\": \"http_ratelimit\"},\n }\n ]\n}",
Is it enough to create a rulesets like this
Response:
{ "result": null, "success": false, "errors": [ { "code": 20018, "message": "logging options only allowed in the skip action", "source": { "pointer": "/rules/0/logging" } }, { "code": 20132, "message": "only ratelimit rules can be placed in the http_ratelimit phase", "source": { "pointer": "/rules/0" } } ], "messages": null }
what am I doing