|
1 | 1 | --- |
2 | | -title: Configure Schema Validation via the API |
| 2 | +title: Configure Schema validation via the API |
3 | 3 | pcx_content_type: how-to |
4 | 4 |
|
5 | 5 | sidebar: |
6 | 6 | label: API |
7 | 7 | head: |
8 | 8 | - tag: title |
9 | | - content: Configure Schema Validation |
| 9 | + content: Configure Schema validation |
10 | 10 | --- |
11 | 11 |
|
12 | 12 | import { GlossaryTooltip, Steps, APIRequest } from "~/components" |
13 | 13 |
|
14 | | -Schema Validation 2.0 allows all corresponding configuration calls to be made via API. This validation centers more around individual <GlossaryTooltip term="API endpoint">endpoints</GlossaryTooltip> and lets you set mitigation actions for each endpoint individually. Additionally, you can use Cloudflare-provided learned schemas that we [learn automatically](/api-shield/management-and-monitoring/#endpoint-schema-learning) from your traffic for individual endpoints. |
| 14 | +Schema validation 2.0 allows all corresponding configuration calls to be made via API. This validation centers more around individual <GlossaryTooltip term="API endpoint">endpoints</GlossaryTooltip> and lets you set mitigation actions for each endpoint individually. Additionally, you can use Cloudflare-provided learned schemas that we [learn automatically](/api-shield/management-and-monitoring/#endpoint-schema-learning) from your traffic for individual endpoints. |
15 | 15 |
|
16 | 16 | :::note |
17 | 17 |
|
18 | | -[Classic Schema Validation documentation](/api-shield/reference/classic-schema-validation/) is available for reference only. |
| 18 | +[Classic Schema validation documentation](/api-shield/reference/classic-schema-validation/) is available for reference only. |
19 | 19 | ::: |
20 | 20 |
|
21 | | -## Upload schemas via the API to Schema Validation |
| 21 | +## Upload schemas via the API to Schema validation |
22 | 22 |
|
23 | 23 | <Steps> |
24 | 24 | 1. Upload a schema. |
25 | 25 | 2. Ensure that your endpoints are added in Endpoint Management. |
26 | 26 | 3. Set the schema to `active` if it is not already done. |
27 | | -4. Set the Schema Validation zone-wide action from `none` to `log`. |
| 27 | +4. Set the Schema validation zone-wide action from `none` to `log`. |
28 | 28 | 5. Send test traffic that violates the schema. |
29 | | -6. View test traffic in Security Events by filtering for **Service** > **API Shield - Schema Validation**. |
| 29 | +6. View test traffic in Security Events by filtering for **Service** > **API Shield - Schema validation**. |
30 | 30 | 7. Optional: |
31 | 31 | - Set a single endpoint to `block`. |
32 | | - - Set the Schema Validation zone-wide to `block`. |
| 32 | + - Set the Schema validation zone-wide to `block`. |
33 | 33 | - Temporarily override all schemas zone-wide to `none`. |
34 | 34 | - Remove the temporary override. |
35 | 35 | </Steps> |
36 | 36 |
|
37 | | -Cloudflare recommends you to rerun test traffic and monitor the HTTP response codes after changing any settings to ensure Schema Validation is operating as expected. |
| 37 | +Cloudflare recommends you to rerun test traffic and monitor the HTTP response codes after changing any settings to ensure Schema validation is operating as expected. |
38 | 38 |
|
39 | 39 | Settings changes may take a few minutes to implement. |
40 | 40 |
|
41 | 41 | :::note |
42 | 42 |
|
43 | | -Endpoints must be listed in Endpoint Management for Schema Validation to match requests. |
| 43 | +Endpoints must be listed in Endpoint Management for Schema validation to match requests. |
44 | 44 | ::: |
45 | 45 |
|
46 | 46 | ## Configuration |
@@ -81,7 +81,7 @@ Upload a schema via the v4 API using `POST`. This example requires a `example_sc |
81 | 81 | } |
82 | 82 | ``` |
83 | 83 |
|
84 | | -By default, Schema Validation is disabled for an uploaded schema so that you can inspect it first. You can upload a schema and enable it immediately by setting the form parameter `validation_enabled=true`. |
| 84 | +By default, Schema validation is disabled for an uploaded schema so that you can inspect it first. You can upload a schema and enable it immediately by setting the form parameter `validation_enabled=true`. |
85 | 85 |
|
86 | 86 | Use a `PATCH` request to activate a schema after inspection. |
87 | 87 |
|
@@ -115,7 +115,7 @@ When a schema is active, it executes the mitigation action specified for each op |
115 | 115 |
|
116 | 116 | ### Add new operations to Endpoint Management |
117 | 117 |
|
118 | | -Schemas contain a set of servers, paths, and methods, which together define an operation. Schema Validation only acts on the requests to operations which have been added to the API Shield Endpoint Management. If a schema contains operations which have not been added to Endpoint Management, they can be retrieved together with the configuration information about added operations. |
| 118 | +Schemas contain a set of servers, paths, and methods, which together define an operation. Schema validation only acts on the requests to operations which have been added to the API Shield Endpoint Management. If a schema contains operations which have not been added to Endpoint Management, they can be retrieved together with the configuration information about added operations. |
119 | 119 |
|
120 | 120 | ```bash title="cURL command" |
121 | 121 | curl --request GET "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gateway/user_schemas/{schema_id}/operations?feature=schema_info&operation_status=new&page=1&per_page=5000" \ |
@@ -425,9 +425,9 @@ curl --request PUT "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gat |
425 | 425 | Parameter schemas are updated between every 24 hours up to one week. To ensure that a parameter schema has not been updated during the inspection, Cloudflare recommends that you pass the `last_updated` timestamp of the parameter-schema feature (not the `last_updated` of the whole operation) as an identifier in the timestamp query parameter. |
426 | 426 | ::: |
427 | 427 |
|
428 | | -### Disable Schema Validation |
| 428 | +### Disable Schema validation |
429 | 429 |
|
430 | | -To quickly disable Schema Validation for a whole zone, use `PATCH`. This operation will override all operation-mitigation actions. |
| 430 | +To quickly disable Schema validation for a whole zone, use `PATCH`. This operation will override all operation-mitigation actions. |
431 | 431 |
|
432 | 432 | ```bash title="cURL command" |
433 | 433 | curl --request PATCH "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gateway/settings/schema_validation" \ |
|
0 commit comments