アカウントまたはゾーンレベルで、ルールセット内の 1 つのルールを削除します。
次のいずれかの API エンドポイントを使います。
- アカウントルールセットのルールを削除する
DELETE /accounts/{account_id}/rulesets/{ruleset_id}/rules/{rule_id} - ゾーンルールセットのルールを削除する
DELETE /zones/{zone_id}/rulesets/{ruleset_id}/rules/{rule_id}
削除が成功すると、API メソッドは 200 OK HTTP ステータスコードを返し、レスポンスボディに完全なルールセットを含めます。
次の例は、ルールセット $RULESET_ID に属するルール $RULE_ID_1 を削除します。
レスポンスには、ルール削除後の完全なルールセットが含まれます。
Required API token permissions
At least one of the following token permissions is required:Mass URL Redirects WriteMagic Firewall WriteL4 DDoS Managed Ruleset WriteTransform Rules WriteSelect Configuration WriteAccount WAF WriteAccount Rulesets WriteLogs Write
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/rulesets/$RULESET_ID/rules/$RULE_ID_1" \
--request DELETE \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"{
"result": {
"id": "<RULESET_ID>",
"name": "Custom Ruleset 1",
"description": "My first custom ruleset",
"kind": "custom",
"version": "12",
"rules": [
{
"id": "<RULE_ID_2>",
"version": "2",
"action": "js_challenge",
"expression": "(ip.src.country in {\"GB\" \"FR\"} and cf.bot_management.score < 20 and not cf.bot_management.verified_bot)",
"description": "challenge GB and FR based on bot score",
"last_updated": "2021-07-22T12:54:58.144683Z",
"ref": "<RULE_REF_2>",
"enabled": true
}
],
"last_updated": "2021-07-22T12:54:58.144683Z",
"phase": "http_request_firewall_custom"
},
"success": true,
"errors": [],
"messages": []
}