Skip to content

Commit cd90c69

Browse files
committed
Update examples that require a component fix (TODO)
1 parent 4f66077 commit cd90c69

File tree

2 files changed

+46
-21
lines changed

2 files changed

+46
-21
lines changed

src/content/docs/rules/cloud-connector/create-api.mdx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ head:
88
content: Configure a Cloud Connector rule via API
99
---
1010

11+
import { APIRequest } from "~/components";
12+
1113
You can configure Cloud Connector rules using the [Cloudflare API](/fundamentals/api/).
1214

1315
## Required permissions
@@ -43,10 +45,7 @@ The following table summarizes the available operations.
4345

4446
The following example returns a list of existing Cloud Connector rules:
4547

46-
```bash
47-
curl https://api.cloudflare.com/client/v4/zones/{zone_id}/cloud_connector/rules \
48-
--header "Authorization: Bearer <API_TOKEN>"
49-
```
48+
<APIRequest path="/zones/{zone_id}/cloud_connector/rules" method="GET" />
5049

5150
```json output
5251
{
@@ -76,6 +75,21 @@ To create a new rule and keep all existing rules, you must include them all in y
7675

7776
The following example request will replace all existing Cloud Connector rules with a single rule:
7877

78+
TODO Fix example.
79+
80+
<APIRequest
81+
path="/zones/{zone_id}/cloud_connector/rules"
82+
method="PUT"
83+
json={{
84+
expression: 'http.request.uri.path wildcard "/images/*"',
85+
provider: "cloudflare_r2",
86+
description: "Connect to R2 bucket containing images",
87+
parameters: {
88+
host: "mybucketcustomdomain.example.com",
89+
},
90+
}}
91+
/>
92+
7993
```bash
8094
curl --request PUT \
8195
"https://api.cloudflare.com/client/v4/zones/{zone_id}/cloud_connector/rules" \

src/content/docs/rules/snippets/create-api.mdx

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ head:
99
content: Configure Snippets via API
1010
---
1111

12+
import { APIRequest } from "~/components";
13+
1214
You can create Snippets using the [Cloudflare API](/fundamentals/api/).
1315

1416
## Required permissions
@@ -48,7 +50,18 @@ The following table summarizes the available operations.
4850

4951
### Create/update code snippet
5052

51-
To create or update a Snippet, use the following `PUT` request. The snippet is named `{snippet_name}` and the body contains the JavaScript code.
53+
To create or update a Snippet, use the following `PUT` request. The snippet is named `$SNIPPET_NAME` and the body contains the JavaScript code.
54+
55+
TODO Fix example.
56+
57+
<APIRequest
58+
path="/zones/{zone_id}/snippets/{snippet_name}"
59+
method="PUT"
60+
form={{
61+
files: "@example.js",
62+
metadata: '{"main_module": "example.js"}',
63+
}}
64+
/>
5265

5366
```bash
5467
curl --request PUT https://api.cloudflare.com/client/v4/zones/{zone_id}/snippets/{snippet_name} \
@@ -90,19 +103,17 @@ When using this endpoint to create a new rule and keep existing rules, you must
90103

91104
Once you have created a code snippet, you can link it to rules. This is done via the following `PUT` request to the `snippet_rules` endpoint.
92105

93-
```bash
94-
curl --request PUT \
95-
"https://api.cloudflare.com/client/v4/zones/{zone_id}/snippets/snippet_rules" \
96-
--header "Authorization: Bearer <API_TOKEN>" \
97-
--header "Content-Type: application/json" \
98-
--data '{
99-
"rules": [
100-
{
101-
"description": "Trigger snippet on specific cookie",
102-
"enabled": true,
103-
"expression": "http.cookie eq \"a=b\"",
104-
"snippet_name": "snippet_name_01"
105-
}
106-
]
107-
}'
108-
```
106+
<APIRequest
107+
path="/zones/{zone_id}/snippets/snippet_rules"
108+
method="PUT"
109+
json={{
110+
rules: [
111+
{
112+
description: "Trigger snippet on specific cookie",
113+
enabled: true,
114+
expression: 'http.cookie eq "a=b"',
115+
snippet_name: "snippet_name_01",
116+
},
117+
],
118+
}}
119+
/>

0 commit comments

Comments
 (0)