カスタムルールセットの作成
アカウントルールセットの作成操作を使用してカスタムルールセットを作成します。その際、以下の点に注意してください:
kindフィールドをcustomに設定します。phaseフィールドにカスタムルールセットを作成したいフェーズの名前を指定します。
以下のリクエストは、新しいカスタムルールセットを作成します:
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/rulesets \--header "Authorization: Bearer <API_TOKEN>" \--header "Content-Type: application/json" \--data '{ "name": "Custom Ruleset 1", "description": "私の最初のカスタムルールセット", "kind": "custom", "phase": "http_request_firewall_custom"}'レスポンスには、新しいカスタムルールセットのidフィールドにルールセットIDが含まれています:
{ "result": { "id": "f82ccda3d21f4a02825d3fe45b5e1c10", "name": "Custom Ruleset 1", "description": "私の最初のカスタムルールセット", "kind": "custom", "version": "1", "last_updated": "2021-03-09T10:27:30.636197Z", "phase": "http_request_firewall_custom" }, "success": true, "errors": [], "messages": []}カスタムルールセットの作成リクエストにルールのリストを含めることができます。ルールを追加していない場合は、カスタムルールセットにルールを追加するを参照してください。