Skip to content

Commit 567d714

Browse files
committed
Add APIRequest to DLS docs
1 parent 544588c commit 567d714

File tree

2 files changed

+49
-56
lines changed

2 files changed

+49
-56
lines changed

src/content/docs/data-localization/metadata-boundary/get-started.mdx

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar:
55
order: 2
66
---
77

8-
import { Details } from "~/components";
8+
import { Details, APIRequest } from "~/components";
99

1010
You can configure the Metadata Boundary to select the region where your logs and analytics are stored via API or dashboard.
1111

@@ -31,31 +31,25 @@ These are some examples of API requests.
3131

3232
Here is an example request using cURL to get current regions (if any):
3333

34-
```bash
35-
curl -s -D "/dev/stderr" https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/logs/control/cmb/config -X GET \
36-
-H "X-Auth-Email: <EMAIL>" \
37-
-H "X-Auth-Key: <KEY>" \
38-
| jq '.'
39-
```
34+
<APIRequest
35+
path="/accounts/{account_id}/logs/control/cmb/config"
36+
method="GET"
37+
/>
4038

4139
</Details>
4240

4341
<Details header="Setting regions">
4442

4543
Here is an example request using cURL to set regions:
4644

47-
```bash
48-
curl -s -D "/dev/stderr" https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/logs/control/cmb/config -X POST -d '
49-
{
50-
"regions": "eu",
51-
"allow_out_of_region_access": false
52-
}
53-
' \
54-
-H "X-Auth-Email: <EMAIL>" \
55-
-H "X-Auth-Key: <KEY>" \
56-
| jq '.'
57-
58-
```
45+
<APIRequest
46+
path="/accounts/{account_id}/logs/control/cmb/config"
47+
method="POST"
48+
json={{
49+
regions: "eu",
50+
allow_out_of_region_access: false
51+
}}
52+
/>
5953

6054
This will overwrite any previous regions.
6155
Change will be in effect after several minutes.
@@ -66,12 +60,10 @@ Change will be in effect after several minutes.
6660

6761
Here is an example request using cURL to delete regions:
6862

69-
```bash
70-
curl -s -D "/dev/stderr" https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/logs/control/cmb/config -X DELETE \
71-
-H "X-Auth-Email: <EMAIL>" \
72-
-H "X-Auth-Key: <KEY>" \
73-
| jq '.'
74-
```
63+
<APIRequest
64+
path="/accounts/{account_id}/logs/control/cmb/config"
65+
method="DELETE"
66+
/>
7567

7668
</Details>
7769

src/content/docs/data-localization/regional-services/get-started.mdx

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ head:
88
content: Get Started — Regional Services
99
---
1010

11-
import { Details } from "~/components";
11+
import { Details, APIRequest } from "~/components";
1212

1313
:::note
1414

@@ -45,10 +45,10 @@ These are some examples of API requests.
4545

4646
<Details header="List all the available regions">
4747

48-
```bash title="Request"
49-
curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/addressing/regional_hostnames/regions" \
50-
--header "Authorization: Bearer <API_TOKEN>" | jq .
51-
```
48+
<APIRequest
49+
path="/accounts/{account_id}/addressing/regional_hostnames/regions"
50+
method="GET"
51+
/>
5252

5353
```json title="Response"
5454
{
@@ -72,12 +72,14 @@ curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/addressing/regi
7272

7373
<Details header="Create a new regional hostname entry">
7474

75-
```bash title="Request"
76-
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/addressing/regional_hostnames" \
77-
--header "Authorization: Bearer <API_TOKEN>" \
78-
--header "Content-Type: application/json" \
79-
--data '{"hostname": "ca.regional.ipam.rocks", "region_key": "ca"}' | jq .
80-
```
75+
<APIRequest
76+
path="/zones/{zone_id}/addressing/regional_hostnames"
77+
method="POST"
78+
json={{
79+
hostname: "ca.regional.ipam.rocks",
80+
region_key: "ca"
81+
}}
82+
/>
8183

8284
```json title="Response"
8385
{
@@ -96,10 +98,10 @@ curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/addressing/regional_h
9698

9799
<Details header="List all regional hostnames for a zone or get a specific one">
98100

99-
```bash title="Request"
100-
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/addressing/regional_hostnames" \
101-
--header "Authorization: Bearer <API_TOKEN>" | jq .
102-
```
101+
<APIRequest
102+
path="/zones/{zone_id}/addressing/regional_hostnames"
103+
method="GET"
104+
/>
103105

104106
```json title="Response"
105107
{
@@ -120,10 +122,10 @@ curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/addressing/regional_h
120122

121123
<Details header="List all regional hostnames for a specific zone">
122124

123-
```bash title="Request"
124-
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/addressing/regional_hostnames/ca.regional.ipam.rocks" \
125-
--header "Authorization: Bearer <API_TOKEN>" | jq .
126-
```
125+
<APIRequest
126+
path="/zones/{zone_id}/addressing/regional_hostnames/{hostname}"
127+
method="GET"
128+
/>
127129

128130
```json title="Response"
129131
{
@@ -142,13 +144,13 @@ curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/addressing/regional_h
142144

143145
<Details header="Patch the region for a specific hostname">
144146

145-
```bash title="Request"
146-
curl --request PATCH \
147-
"https://api.cloudflare.com/client/v4/zones/{zone_id}/addressing/regional_hostnames/ca.regional.ipam.rocks" \
148-
--header "Authorization: Bearer <API_TOKEN>" \
149-
--header "Content-Type: application/json" \
150-
--data '{"region_key": "eu"}' | jq .
151-
```
147+
<APIRequest
148+
path="/zones/{zone_id}/addressing/regional_hostnames/{hostname}"
149+
method="PATCH"
150+
json={{
151+
region_key: "eu"
152+
}}
153+
/>
152154

153155
```json title="Response"
154156
{
@@ -167,11 +169,10 @@ curl --request PATCH \
167169

168170
<Details header="Delete the region configuration">
169171

170-
```bash title="Request"
171-
curl --request DELETE \
172-
"https://api.cloudflare.com/client/v4/zones/{zone_id}/addressing/regional_hostnames/ca.regional.ipam.rocks" \
173-
--header "Authorization: Bearer <API_TOKEN>" | jq .
174-
```
172+
<APIRequest
173+
path="/zones/{zone_id}/addressing/regional_hostnames/{hostname}"
174+
method="DELETE"
175+
/>
175176

176177
```json title="Response"
177178
{

0 commit comments

Comments
 (0)