Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 40 additions & 36 deletions src/content/docs/api-shield/security/schema-validation/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ head:
content: Configure Schema Validation
---

import { GlossaryTooltip, Steps } from "~/components"
import { GlossaryTooltip, Steps, APIRequest } from "~/components"

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.

Expand Down Expand Up @@ -49,13 +49,18 @@ Endpoints must be listed in Endpoint Management for Schema Validation to match r

Upload a schema via the v4 API using `POST`. This example requires a `example_schema.yaml` schema file in the current folder.

```bash title="cURL command"
curl --request POST "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gateway/user_schemas" \
--header "Authorization: Bearer <API_TOKEN>" \
--form file=@example_schema.yaml --form kind=openapi_v3 --form name=example_schema --form validation_enabled=false
```

```json title="Result"
<APIRequest
path="/zones/{zone_id}/schema_validation/schemas"
method="POST"
json={{
kind: "openapi_v3",
name: "example_schema",
source: "<SOURCE>",
validation_enabled: true
}}
/>

```json output
{
"result":
{
Expand All @@ -80,16 +85,15 @@ By default, Schema Validation is disabled for an uploaded schema so that you can

Use a `PATCH` request to activate a schema after inspection.

```bash title="cURL command"
curl --request PATCH "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gateway/user_schemas/{schema_id}" \
--header "Authorization: Bearer <API_TOKEN>" \
--header 'Content-Type: application/json' \
--data '{
"validation_enabled": true
}'
```
<APIRequest
path="/zones/{zone_id}/api_gateway/user_schemas/{schema_id}"
method="PATCH"
json={{
validation_enabled: true,
}}
/>

```json title="Result"
```json output
{
"result":
{
Expand Down Expand Up @@ -119,7 +123,7 @@ curl --request GET "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gat
--header 'Content-Type: application/json'
```

```json title="Result"
```json output
{
"result":
[
Expand Down Expand Up @@ -158,7 +162,7 @@ curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gateway/operation
]'
```

```json title="Result"
```json output
{
"result": [
{
Expand Down Expand Up @@ -202,7 +206,7 @@ curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gateway/settings/
--header "Authorization: Bearer <API_TOKEN>"
```

```json title="Result"
```json output
{
"result": {
"validation_default_mitigation_action": "none",
Expand All @@ -227,7 +231,7 @@ curl --request PUT "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gat
}'
```

```json title="Result"
```json output
{
"result": {
"validation_default_mitigation_action": "block",
Expand All @@ -249,7 +253,7 @@ curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gateway/operation
--header "Authorization: Bearer <API_TOKEN>"
```

```json title="Result"
```json output
{
"result": {
"mitigation_action": "null"
Expand All @@ -276,7 +280,7 @@ curl --request PUT "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gat
}'
```

```json title="Result"
```json output
{
"result": {
"mitigation_action": "block"
Expand All @@ -295,12 +299,12 @@ You can get an overview of the schemas currently active on a zone using `GET`.

`validation_enabled=true` is an optional parameter.

```bash title="cURL command"
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gateway/user_schemas?omit_source=true" \
--header "Authorization: Bearer <API_TOKEN>"
```
<APIRequest
path="/zones/{zone_id}/schema_validation/schemas"
method="GET"
/>

```json title="Result"
```json output
{
"result": [
{
Expand Down Expand Up @@ -329,12 +333,12 @@ We recommend using the query parameter `omit_source=true` to only display active

You can delete a schema using `DELETE`.

```bash title="cURL command"
curl --request DELETE "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gateway/user_schemas/{schema_id}" \
--header "Authorization: Bearer <API_TOKEN>"
```
<APIRequest
path="/zones/{zone_id}/schema_validation/schemas/{schema_id}"
method="DELETE"
/>

```json title="Result"
```json output
{
"result": null,
"success": true,
Expand All @@ -354,7 +358,7 @@ curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gateway/operation
--header "Authorization: Bearer <API_TOKEN>"
```

```json title="Result"
```json output
{
"result":
{
Expand Down Expand Up @@ -404,7 +408,7 @@ curl --request PUT "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_gat
--header "Authorization: Bearer <API_TOKEN>"
```

```json title="Result"
```json output
{
"result": null,
"success": true,
Expand Down Expand Up @@ -434,7 +438,7 @@ curl --request PATCH "https://api.cloudflare.com/client/v4/zones/{zone_id}/api_g
}'
```

```json title="Result"
```json output
{
"result": {
"validation_default_mitigation_action": "block",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sidebar:

---

import { GlossaryTooltip, Steps, Render } from "~/components"
import { GlossaryTooltip, Steps, Render, APIRequest } from "~/components"

Cloudflare Volumetric Abuse Detection helps you set up a system of adaptive rate limiting.

Expand Down Expand Up @@ -60,6 +60,11 @@ Refer to the [Rules documentation](https://developers.cloudflare.com/waf/rate-li

[Rate limit recommendations are available via the API](/api/resources/api_gateway/subresources/operations/methods/get/) if you would like to dynamically update rate limits over time.

<APIRequest
path="/zones/{zone_id}/api_gateway/operations/{operation_id}"
method="GET"
/>

## Special cases

<Render file="rate-limit-user" />
Expand Down
18 changes: 9 additions & 9 deletions src/content/docs/bots/frequently-asked-questions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar:
order: 11
---

import { Render, RuleID } from "~/components";
import { Render, RuleID, APIRequest } from "~/components";

## Bots

Expand Down Expand Up @@ -171,19 +171,19 @@ This is a known issue the Bots team is working to resolve in the near future. In

1. List the existing Rulesets at the zone level.

```bash
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/rulesets" \
--header "Authorization: Bearer <API_TOKEN>"
```
<APIRequest
path="/zones/{zone_id}/rulesets"
method="GET"
/>

2. From the output in step 1, find the ruleset ID that is associated with the zone's SBFM configuration. You should be able to see `"kind": "zone"` and `"phase": "http_request_sbfm"` for that ruleset.

3. Use the ruleset ID you found to delete the SBFM ruleset.

```bash
curl --request DELETE "https://api.cloudflare.com/client/v4/zones/{zone_id}/rulesets/{ruleset_id}" \
--header "Authorization: Bearer <API_TOKEN>"
```
<APIRequest
path="/zones/{zone_id}/rulesets/{ruleset_id}"
method="DELETE"
/>

Note that you need to replace `<API_TOKEN>` with your own [API token](/fundamentals/api/get-started/create-token/).

Expand Down
24 changes: 11 additions & 13 deletions src/content/docs/ddos-protection/botnet-threat-feed.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ learning_center:
link: https://www.cloudflare.com/learning/ddos/what-is-a-ddos-botnet/

---
import { Steps } from "~/components"
import { Steps, APIRequest } from "~/components"

The Cloudflare DDoS Botnet Threat Feed is a threat intelligence feed for service providers (SPs) such as hosting providers and Internet service providers (ISPs) that provides information about their own IP addresses that have participated in HTTP DDoS attacks as observed from Cloudflare's global network. The feed aims to help service providers stop the abuse and reduce DDoS attacks originating from within their networks.

Expand Down Expand Up @@ -96,13 +96,12 @@ Retrieves all the data in the botnet tracking database for a given ASN (currentl

The provided `{asn}` must be affiliated with your account.

```bash title="Example request"
curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/botnet_feed/asn/{asn}/full_report" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <API_TOKEN>"
```
<APIRequest
path="/accounts/{account_id}/botnet_feed/asn/{asn_id}/full_report"
method="GET"
/>

```json title="Example response"
```json output
{
"result": [
{
Expand All @@ -129,13 +128,12 @@ The provided `{asn}` must be affiliated with your account.

`{date}` must be an ISO 8601-formatted date: `YYYY-MM-DD`. If no date is specified, the API responds with the data from the day before.

```bash title="Example request"
curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/botnet_feed/asn/{asn}/day_report?date=2024-05-05" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <API_TOKEN>"
```
<APIRequest
path="/accounts/{account_id}/botnet_feed/asn/{asn_id}/day_report"
method="GET"
/>

```json title="Example response"
```json output
{
"result": [
{
Expand Down
Loading