|
6 | 6 |
|
7 | 7 | --- |
8 | 8 |
|
9 | | -import { Details, Render } from "~/components" |
| 9 | +import { Details, Render, APIRequest } from "~/components" |
10 | 10 |
|
11 | 11 | 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/). |
12 | 12 |
|
@@ -49,19 +49,20 @@ When creating A or AAAA records [using the API](/dns/manage-dns-records/how-to/c |
49 | 49 |
|
50 | 50 | <Render file="api-field-definitions" /> |
51 | 51 |
|
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 | +/> |
65 | 66 |
|
66 | 67 | ```json title="Response" |
67 | 68 | { |
@@ -119,23 +120,24 @@ Specific CNAME record values with traffic proxied through Cloudflare will enable |
119 | 120 | When creating CNAME records [using the API](/dns/manage-dns-records/how-to/create-dns-records/#create-dns-records): |
120 | 121 |
|
121 | 122 | * 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/). |
123 | 124 |
|
124 | 125 | <Render file="api-field-definitions" /> |
125 | 126 |
|
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 | +/> |
139 | 141 |
|
140 | 142 | ```json title="Response" |
141 | 143 | { |
@@ -242,22 +244,20 @@ A [service record (SRV)](https://www.cloudflare.com/learning/dns/dns-records/dns |
242 | 244 |
|
243 | 245 | <Render file="api-field-definitions" /> |
244 | 246 |
|
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 | +/> |
261 | 261 |
|
262 | 262 | ```json title="Response" |
263 | 263 | { |
|
0 commit comments