Skip to content

Commit c9c350e

Browse files
Replace API examples in dns-record-types
1 parent c6adbb0 commit c9c350e

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

src/content/docs/dns/manage-dns-records/reference/dns-record-types.mdx

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar:
66

77
---
88

9-
import { Details, Render } from "~/components"
9+
import { Details, Render, APIRequest } from "~/components"
1010

1111
This page provides information about some of the different types of DNS records that you can manage on Cloudflare. For guidance on how to add, edit, or delete DNS records, refer to [Manage DNS records](/dns/manage-dns-records/how-to/create-dns-records/).
1212

@@ -49,19 +49,20 @@ When creating A or AAAA records [using the API](/dns/manage-dns-records/how-to/c
4949

5050
<Render file="api-field-definitions" />
5151

52-
```bash title="Request" {8,10}
53-
curl "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/dns_records" \
54-
--header "X-Auth-Email: <EMAIL>" \
55-
--header "X-Auth-Key: <API_KEY>" \
56-
--header "Content-Type: application/json" \
57-
--data '{
58-
"type": "A",
59-
"name": "www.example.com",
60-
"content": "192.0.2.1",
61-
"ttl": 3600,
62-
"proxied": false
63-
}'
64-
```
52+
<APIRequest
53+
path="/zones/{zone_id}/dns_records"
54+
method="POST"
55+
json={{
56+
"type": "A",
57+
"name": "www.example.com",
58+
"content": "192.0.2.1",
59+
"ttl": 3600,
60+
"proxied": false
61+
}}
62+
code={{
63+
mark: [8, 10],
64+
}}
65+
/>
6566

6667
```json title="Response"
6768
{
@@ -119,23 +120,24 @@ Specific CNAME record values with traffic proxied through Cloudflare will enable
119120
When creating CNAME records [using the API](/dns/manage-dns-records/how-to/create-dns-records/#create-dns-records):
120121

121122
* The `content` of the records is a [fully qualified domain name](https://en.wikipedia.org/wiki/Fully_qualified_domain_name).
122-
* The `proxied` field affects the record's [proxy status](/dns/proxy-status/)
123+
* The `proxied` field affects the record's [proxy status](/dns/proxy-status/).
123124

124125
<Render file="api-field-definitions" />
125126

126-
```bash title="Request" {8,10}
127-
curl "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/dns_records" \
128-
--header "X-Auth-Email: <EMAIL>" \
129-
--header "X-Auth-Key: <API_KEY>" \
130-
--header "Content-Type: application/json" \
131-
--data '{
132-
"type": "CNAME",
133-
"name": "www.example.com",
134-
"content": "www.another-example.com",
135-
"ttl": 3600,
136-
"proxied": false
137-
}'
138-
```
127+
<APIRequest
128+
path="/zones/{zone_id}/dns_records"
129+
method="POST"
130+
json={{
131+
"type": "CNAME",
132+
"name": "www.example.com",
133+
"content": "www.another-example.com",
134+
"ttl": 3600,
135+
"proxied": false
136+
}}
137+
code={{
138+
mark: [8, 10],
139+
}}
140+
/>
139141

140142
```json title="Response"
141143
{
@@ -242,22 +244,20 @@ A [service record (SRV)](https://www.cloudflare.com/learning/dns/dns-records/dns
242244

243245
<Render file="api-field-definitions" />
244246

245-
```bash title="Request"
246-
curl "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/dns_records" \
247-
--header "X-Auth-Email: <EMAIL>" \
248-
--header "X-Auth-Key: <API_KEY>" \
249-
--header "Content-Type: application/json" \
250-
--data '{
251-
"type": "SRV",
252-
"name": "_xmpp._tcp.example.com",
253-
"data": {
254-
"priority": 10,
255-
"weight": 5,
256-
"port": 5223,
257-
"target": "server.example.com"
258-
}
259-
}'
260-
```
247+
<APIRequest
248+
path="/zones/{zone_id}/dns_records"
249+
method="POST"
250+
json={{
251+
"type": "SRV",
252+
"name": "_xmpp._tcp.example.com",
253+
"data": {
254+
"priority": 10,
255+
"weight": 5,
256+
"port": 5223,
257+
"target": "server.example.com"
258+
}
259+
}}
260+
/>
261261

262262
```json title="Response"
263263
{

0 commit comments

Comments
 (0)