- ホーム
- クライアントサイド防御
- API リファレンス
API リファレンス
CSD には、ドメイン、スクリプト、軽減、およびモニタリングを管理するための専用 API /api/shape/csd/ があります。また、ロードバランサー設定 API を通じて HTTP ロードバランサーで CSD を有効にすることもできます。
すべての API 呼び出しには API トークンが必要です。XC コンソールの 管理 → 認証情報 → API 認証情報 でトークンを生成してください。
環境変数の設定については、API 自動化 — 環境セットアップ を参照してください:
set -a && source .env && set +aすべての curl の例では xTOKENx プレースホルダー形式を使用しています。環境変数で置き換えるか、ページ上部のインタラクティブフォームを使用してください。たとえば、xF5XC_API_TOKENx は $F5XC_API_TOKEN に対応します。
-H "Authorization: APIToken xF5XC_API_TOKENx"API の規則
Section titled “API の規則”レスポンスボディ
Section titled “レスポンスボディ”- POST は作成されたオブジェクトを JSON として返します。
- PUT および DELETE は HTTP 200 で空の
\{\}を返します — これは正常であり、エラーではありません。空のレスポンスボディを失敗として扱わないでください。
リストエンドポイントと GET エンドポイント
Section titled “リストエンドポイントと GET エンドポイント”リストエンドポイント(例: /healthchecks、/origin_pools、/protected_domains)と個別の GET エンドポイント(例: /healthchecks/\{name\})では、異なるレスポンス構造が返されます:
| エンドポイントタイプ | パス例 | レスポンス構造 |
|---|---|---|
| リスト | /origin_pools | アイテムにはトップレベルの .name、.namespace、.tenant があり、metadata: null および get_spec: null |
| 個別 GET | /origin_pools/\{name\} | オブジェクトには .metadata.name、.spec.* と完全な設定が含まれる |
それぞれに適切な jq パスを使用してください。たとえば、リストエンドポイントから名前を抽出するには .items[].name を使用し、.items[].metadata.name は使用しないでください。
保護ドメインの識別子
Section titled “保護ドメインの識別子”保護ドメインの GET および DELETE 操作では、\{name\} パスパラメーターは任意のオブジェクト名ではなく、ドメイン値そのもの(例: bankexample.com)です。これは、名前がユーザーが選択した識別子である他の F5 XC オブジェクトとは異なります。
CSD API エンドポイント
Section titled “CSD API エンドポイント”ベースパス: /api/shape/csd/namespaces/\{namespace\}/
ステータスと初期化
Section titled “ステータスと初期化”| 操作 | メソッド | パス |
|---|---|---|
| CSD の有効化 | POST | /api/shape/csd/namespaces/system/init |
| ステータスの取得 | GET | /api/shape/csd/namespaces/\{namespace\}/status |
| JS 設定の取得 | GET | /api/shape/csd/namespaces/\{namespace\}/js_configuration |
| JS のテスト | POST | /api/shape/csd/namespaces/\{namespace\}/testjs |
| ドメインの更新 | POST | /api/shape/csd/namespaces/\{namespace\}/update_domains |
保護ドメイン
Section titled “保護ドメイン”| 操作 | メソッド | パス |
|---|---|---|
| リスト | GET | /api/shape/csd/namespaces/\{namespace\}/protected_domains |
| 取得 | GET | /api/shape/csd/namespaces/\{namespace\}/protected_domains/\{name\} |
| 作成 | POST | /api/shape/csd/namespaces/\{namespace\}/protected_domains |
| 削除 | DELETE | /api/shape/csd/namespaces/\{namespace\}/protected_domains/\{name\} |
検出済みドメイン
Section titled “検出済みドメイン”| 操作 | メソッド | パス |
|---|---|---|
| 検出済みのリスト | GET | /api/shape/csd/namespaces/\{namespace\}/detected_domains |
| 詳細の取得 | GET | /api/shape/csd/namespaces/\{namespace\}/domain_details |
許可ドメイン
Section titled “許可ドメイン”| 操作 | メソッド | パス |
|---|---|---|
| リスト | GET | /api/shape/csd/namespaces/\{namespace\}/allowed_domains |
| 取得 | GET | /api/shape/csd/namespaces/\{namespace\}/allowed_domains/\{name\} |
| 作成 | POST | /api/shape/csd/namespaces/\{namespace\}/allowed_domains |
| 削除 | DELETE | /api/shape/csd/namespaces/\{namespace\}/allowed_domains/\{name\} |
軽減済みドメイン
Section titled “軽減済みドメイン”| 操作 | メソッド | パス |
|---|---|---|
| リスト | GET | /api/shape/csd/namespaces/\{namespace\}/mitigated_domains |
| 取得 | GET | /api/shape/csd/namespaces/\{namespace\}/mitigated_domains/\{name\} |
| 作成 | POST | /api/shape/csd/namespaces/\{namespace\}/mitigated_domains |
| 削除 | DELETE | /api/shape/csd/namespaces/\{namespace\}/mitigated_domains/\{name\} |
| 操作 | メソッド | パス |
|---|---|---|
| スクリプトのリスト | POST | /api/shape/csd/namespaces/\{namespace\}/scripts |
| スクリプトのリスト(レガシー) | GET | /api/shape/csd/namespaces/\{namespace\}/scripts |
| スクリプト概要の取得 | GET | /api/shape/csd/namespaces/\{namespace\}/scripts/\{id\}/dashboard |
| 動作のリスト | GET | /api/shape/csd/namespaces/\{namespace\}/scripts/\{id\}/behaviors |
| ネットワークインタラクションのリスト | GET | /api/shape/csd/namespaces/\{namespace\}/scripts/\{id\}/networkInteractions |
| 正当性の更新 | POST | /api/shape/csd/namespaces/\{namespace\}/scripts/\{script_id\}/justification |
| 正当性の削除 | DELETE | /api/shape/csd/namespaces/\{namespace\}/script/justification/\{justification_id\} |
| 既読ステータスの更新 | POST | /api/shape/csd/namespaces/\{namespace\}/scripts/\{id\}/readStatus |
| 影響を受けたユーザーのリスト | POST | /api/shape/csd/namespaces/\{namespace\}/scripts/\{script_id\}/affectedUsers |
フォームフィールド
Section titled “フォームフィールド”| 操作 | メソッド | パス |
|---|---|---|
| フォームフィールドのリスト | GET | /api/shape/csd/namespaces/\{namespace\}/formFields |
| フォームフィールドのリスト(POST) | POST | /api/shape/csd/namespaces/\{namespace\}/formFields |
| フォームフィールドの取得 | GET | /api/shape/csd/namespaces/\{namespace\}/formFields/\{id\} |
| スクリプト別リスト | GET | /api/shape/csd/namespaces/\{namespace\}/scripts/\{id\}/formFields |
| フィールド分析の更新 | POST | /api/shape/csd/namespaces/\{namespace\}/formFields/analysis |
CSD の有効化
Section titled “CSD の有効化”テナントの CSD を初期化します:
curl -s -X POST \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ -H "Content-Type: application/json" \ "xF5XC_API_URLx/api/shape/csd/namespaces/system/init"CSD ステータスの取得
Section titled “CSD ステータスの取得”curl -s \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/status" \ | jq .保護ドメイン
Section titled “保護ドメイン”保護ドメインのリスト
Section titled “保護ドメインのリスト”curl -s \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/protected_domains" \ | jq .保護ドメインの追加
Section titled “保護ドメインの追加”curl -s -X POST \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ -H "Content-Type: application/json" \ -d '{ "metadata": { "name": "my-app", "namespace": "xF5XC_NAMESPACEx" }, "spec": {} }' \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/protected_domains" \ | jq .保護ドメインの削除
Section titled “保護ドメインの削除”curl -s -X DELETE \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/protected_domains/my-app"検出済みドメイン
Section titled “検出済みドメイン”検出済みドメインのリスト
Section titled “検出済みドメインのリスト”クエリパラメーター: locations(ロケーションでフィルタリング)、risk(リスクレベルでフィルタリング)。
curl -s \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/detected_domains" \ | jq .高リスクでフィルタリング:
curl -s \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/detected_domains?risk=high" \ | jq .ドメイン詳細の取得
Section titled “ドメイン詳細の取得”curl -s \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/domain_details?name=suspicious.example.com" \ | jq .すべてのスクリプトのリスト
Section titled “すべてのスクリプトのリスト”curl -s -X POST \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ -H "Content-Type: application/json" \ -d '{}' \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/scripts" \ | jq .スクリプト概要の取得
Section titled “スクリプト概要の取得”SCRIPT_ID="your-script-id"
curl -s \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/scripts/${SCRIPT_ID}/dashboard" \ | jq .スクリプト動作のリスト
Section titled “スクリプト動作のリスト”curl -s \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/scripts/${SCRIPT_ID}/behaviors" \ | jq .ネットワークインタラクションのリスト
Section titled “ネットワークインタラクションのリスト”curl -s \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/scripts/${SCRIPT_ID}/networkInteractions" \ | jq .軽減済みドメインの追加
Section titled “軽減済みドメインの追加”curl -s -X POST \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ -H "Content-Type: application/json" \ -d '{ "metadata": { "name": "blocked-domain", "namespace": "xF5XC_NAMESPACEx" }, "spec": {} }' \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/mitigated_domains" \ | jq .軽減済みドメインのリスト
Section titled “軽減済みドメインのリスト”curl -s \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/mitigated_domains" \ | jq .curl -s -X DELETE \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/mitigated_domains/blocked-domain"許可ドメイン
Section titled “許可ドメイン”許可ドメインの追加
Section titled “許可ドメインの追加”curl -s -X POST \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ -H "Content-Type: application/json" \ -d '{ "metadata": { "name": "trusted-cdn", "namespace": "xF5XC_NAMESPACEx" }, "spec": {} }' \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/allowed_domains" \ | jq .許可ドメインのリスト
Section titled “許可ドメインのリスト”curl -s \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/allowed_domains" \ | jq .許可ドメインの削除
Section titled “許可ドメインの削除”curl -s -X DELETE \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/allowed_domains/trusted-cdn"JS インジェクション設定
Section titled “JS インジェクション設定”現在の設定の取得
Section titled “現在の設定の取得”curl -s \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/shape/csd/namespaces/xF5XC_NAMESPACEx/js_configuration" \ | jq .HTTP ロードバランサーの CSD 設定
Section titled “HTTP ロードバランサーの CSD 設定”CSD JavaScript インジェクションは、/api/config/namespaces/\{namespace\}/http_loadbalancers/\{name\} の設定 API を通じて HTTP ロードバランサーで直接有効にすることもできます。
ロードバランサー仕様内の client_side_defense フィールドがインジェクションを制御します:
{ "client_side_defense": { "policy": { "js_insert_all_pages": {} } }}policy には以下のいずれかを指定します:
| フィールド | 説明 |
|---|---|
js_insert_all_pages | すべてのページにインジェクト |
js_insert_all_pages_except | 除外ルール以外のすべてのページにインジェクト |
js_insertion_rules | ルールに一致するページのみにインジェクト |
disable_js_insert | インジェクトしない |
ロードバランサーで CSD を無効にするには、client_side_defense を disable_client_side_defense: \{\} に置き換えてください。
ロードバランサーからの CSD 設定の読み取り
Section titled “ロードバランサーからの CSD 設定の読み取り”curl -s \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/config/namespaces/xF5XC_NAMESPACEx/http_loadbalancers/xF5XC_LB_NAMEx" \ | jq '.spec.client_side_defense'ロードバランサーでの CSD の有効化
Section titled “ロードバランサーでの CSD の有効化”取得、変更、および適用:
curl -s \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ "xF5XC_API_URLx/api/config/namespaces/xF5XC_NAMESPACEx/http_loadbalancers/xF5XC_LB_NAMEx" \ > lb-config.json
jq '.spec |= ( del(.disable_client_side_defense) | .client_side_defense = { "policy": { "js_insert_all_pages": {} } })' lb-config.json > lb-config-updated.json
curl -s -X PUT \ -H "Authorization: APIToken xF5XC_API_TOKENx" \ -H "Content-Type: application/json" \ -d @lb-config-updated.json \ "xF5XC_API_URLx/api/config/namespaces/xF5XC_NAMESPACEx/http_loadbalancers/xF5XC_LB_NAMEx" \ | jq '.spec.client_side_defense'除外ルールのドメインおよびパスマッチング
Section titled “除外ルールのドメインおよびパスマッチング”js_insert_all_pages_except または js_insertion_rules を使用する場合、各ルールはドメインとパスの組み合わせに一致します。
ドメイン(いずれか一つを選択):
| フィールド | 例 |
|---|---|
any_domain: \{\} | すべてのドメイン |
domain.exact_value | "app.example.com" |
domain.suffix_value | ".example.com" |
domain.regex_value | ".*\\.example\\.com" |
パス(いずれか一つを選択):
| フィールド | 例 |
|---|---|
path.path | "/login" |
path.prefix | "/checkout" |
path.regex | "/user/[0-9]+" |
API リファレンス
Section titled “API リファレンス”- CSD API リファレンス — 完全なエンドポイントドキュメント
- CSD の設定 — コンソール設定ガイド
- API 認証情報 — API トークンの生成