Skip to content

[Secrets Store, DNS] Replace examples with APIRequest #23451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
32 changes: 15 additions & 17 deletions src/content/docs/dns/dnssec/dnssec-active-migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,21 @@ The provider you are migrating from must allow you to add DNSKEY records on the

You can do this [on the dashboard](/dns/manage-dns-records/how-to/create-dns-records/#create-dns-records) or through the [Create DNS Record endpoint](/api/resources/dns/subresources/records/methods/create/), as in the following example.

```bash
curl https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_records \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"type": "DNSKEY",
"name": "<ZONE_NAME>",
"data": {
"flags": 256,
"protocol": 3,
"algorithm": 13,
"public_key": "<PUBLIC_KEY>"
},
"ttl":3600
}'
```
<APIRequest
path="/zones/{zone_id}/dns_records"
method="POST"
json={{
"type": "DNSKEY",
"name": "<ZONE_NAME>",
"data": {
"flags": 256,
"protocol": 3,
"algorithm": 13,
"public_key": "<PUBLIC_KEY>"
},
"ttl": 3600
}}
/>

2. Get Cloudflare's ZSK using either the API or a query from one of the assigned Cloudflare nameservers.

Expand Down
28 changes: 12 additions & 16 deletions src/content/docs/dns/dnssec/multi-signer-dnssec/setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ For the purpose of this tutorial, you will update your registrar with the DS rec

2. Add the ZSK(s) of your external provider(s) to Cloudflare by creating a DNSKEY record on your zone.

```bash
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_records" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
<APIRequest
path="/zones/{zone_id}/dns_records"
method="POST"
json={{
"type": "DNSKEY",
"name": "<ZONE_NAME>",
"data": {
Expand All @@ -70,23 +68,21 @@ curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_records" \
"public_key": "<PUBLIC_KEY>"
},
"ttl": 3600
}'
```
}}
/>

3. Add your external provider(s) nameservers as NS records on your zone apex.

```bash
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_records" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
<APIRequest
path="/zones/{zone_id}/dns_records"
method="POST"
json={{
"type": "NS",
"name": "<ZONE_NAME>",
"content": "<NS_DOMAIN>",
"ttl": 86400
}'
```
}}
/>

4. Enable the usage of the nameservers you added in the previous step by using the API request below.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar:

---

import { Details, Render } from "~/components"
import { Details, Render, APIRequest } from "~/components"

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/).

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

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

```bash title="Request" {8,10}
curl "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/dns_records" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"type": "A",
"name": "www.example.com",
"content": "192.0.2.1",
"ttl": 3600,
"proxied": false
}'
```
<APIRequest
path="/zones/{zone_id}/dns_records"
method="POST"
json={{
"type": "A",
"name": "www.example.com",
"content": "192.0.2.1",
"ttl": 3600,
"proxied": false
}}
code={{
mark: [8, 10],
}}
/>

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

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

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

```bash title="Request" {8,10}
curl "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/dns_records" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"type": "CNAME",
"name": "www.example.com",
"content": "www.another-example.com",
"ttl": 3600,
"proxied": false
}'
```
<APIRequest
path="/zones/{zone_id}/dns_records"
method="POST"
json={{
"type": "CNAME",
"name": "www.example.com",
"content": "www.another-example.com",
"ttl": 3600,
"proxied": false
}}
code={{
mark: [8, 10],
}}
/>

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

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

```bash title="Request"
curl "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/dns_records" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"type": "SRV",
"name": "_xmpp._tcp.example.com",
"data": {
"priority": 10,
"weight": 5,
"port": 5223,
"target": "server.example.com"
}
}'
```
<APIRequest
path="/zones/{zone_id}/dns_records"
method="POST"
json={{
"type": "SRV",
"name": "_xmpp._tcp.example.com",
"data": {
"priority": 10,
"weight": 5,
"port": 5223,
"target": "server.example.com"
}
}}
/>

```json title="Response"
{
Expand Down
39 changes: 19 additions & 20 deletions src/content/docs/secrets-store/integrations/workers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar:
label: Use with Workers
---

import { WranglerConfig, Tabs, TabItem } from "~/components";
import { WranglerConfig, Tabs, TabItem, APIRequest } from "~/components";

[Cloudflare Secrets Store](/secrets-store/) is a secure, centralized location in which account-level secrets are stored and managed. The secrets are securely encrypted and stored across all Cloudflare data centers.

Expand Down Expand Up @@ -68,25 +68,24 @@ You can find and copy the store ID from the [Secrets Store tab](https://dash.clo

Refer to [Secrets Store API](/api/resources/secrets_store/) for the full API documentation.

```bash
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/secrets_store/stores/$STORE_ID/secrets \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '[
{
"name":"<MY_SECRET_NAME>",
"value":"<SECRET_VALUE>",
"scopes":["workers"],
"comment":""
},
{
"name":"<MY_SECRET_NAME_2>",
"value":"<SECRET_VALUE>",
"scopes":["workers"],
"comment":""
}
]'
```
<APIRequest
path="/accounts/{account_id}/secrets_store/stores/{store_id}/secrets"
method="POST"
json={[
{
"name":"<MY_SECRET_NAME>",
"value":"<SECRET_VALUE>",
"scopes":["workers"],
"comment":""
},
{
"name":"<MY_SECRET_NAME_2>",
"value":"<SECRET_VALUE>",
"scopes":["workers"],
"comment":""
}
]}
/>

</TabItem> </Tabs>

Expand Down
48 changes: 23 additions & 25 deletions src/content/docs/secrets-store/manage-secrets/how-to.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar:
order: 2
---

import { Tabs, TabItem } from "~/components";
import { Tabs, TabItem, APIRequest } from "~/components";

Refer to the sections below to learn about common actions you might want to take when managing your data in Secrets Store.

Expand All @@ -31,25 +31,24 @@ You must have a [Super Administrator or Secrets Store Admin role](/secrets-store
A secret `name` cannot contain spaces. Refer to [Secrets Store API](/api/resources/secrets_store/) for the full API documentation.
:::

```bash
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/secrets_store/stores/$STORE_ID/secrets \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '[
{
"name":"<MY_SECRET_NAME>",
"value":"<SECRET_VALUE>",
"scopes":["workers"],
"comment":""
},
{
"name":"<MY_SECRET_NAME_2>",
"value":"<SECRET_VALUE>",
"scopes":["workers"],
"comment":""
}
]'
```
<APIRequest
path="/accounts/{account_id}/secrets_store/stores/{store_id}/secrets"
method="POST"
json={[
{
"name":"<MY_SECRET_NAME>",
"value":"<SECRET_VALUE>",
"scopes":["workers"],
"comment":""
},
{
"name":"<MY_SECRET_NAME_2>",
"value":"<SECRET_VALUE>",
"scopes":["workers"],
"comment":""
}
]}
/>

</TabItem> </Tabs>

Expand Down Expand Up @@ -139,10 +138,9 @@ Before deleting a secret, make sure it is not deployed. Secrets Store secrets in

Refer to [Secrets Store API](/api/resources/secrets_store/) for the full API documentation.

```bash
curl --request DELETE \
https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/secrets_store/stores/$STORE_ID/secrets/$SECRET_ID \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
```
<APIRequest
path="/accounts/{account_id}/secrets_store/stores/{store_id}/secrets/{secret_id}"
method="DELETE"
/>

</TabItem> </Tabs>
49 changes: 23 additions & 26 deletions src/content/partials/dns/add-mx-records.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
{}

---

import { APIRequest } from "~/components";

## Receive email

If you only need to **receive** emails, Cloudflare offers [Email Routing](/email-routing/) for free email forwarding to custom email addresses.
Expand All @@ -23,19 +24,17 @@ To **send and receive** emails from your domain, you need an SMTP provider. Then
<summary>API example</summary>
<div>

```bash title="Request"
curl "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/dns_records" \
--header "x-auth-email: <EMAIL>" \
--header "x-auth-key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"type":"A",
"name":"www.example.com",
"content":"192.0.2.1",
"ttl":3600,
"proxied":false
}'
```
<APIRequest
path="/zones/{zone_id}/dns_records"
method="POST"
json={{
"type":"A",
"name":"www.example.com",
"content":"192.0.2.1",
"ttl":3600,
"proxied":false
}}
/>

```json title="Response"
{
Expand Down Expand Up @@ -77,18 +76,16 @@ To **send and receive** emails from your domain, you need an SMTP provider. Then
<summary>API example</summary>
<div>

```bash title="Request"
curl "https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/dns_records" \
--header "x-auth-email: <EMAIL>" \
--header "x-auth-key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"type":"MX",
"name":"example.com",
"content":"mail.example.com",
"ttl":3600
}'
```
<APIRequest
path="/zones/{zone_id}/dns_records"
method="POST"
json={{
"type":"MX",
"name":"example.com",
"content":"mail.example.com",
"ttl":3600
}}
/>

```json title="Response"
{
Expand Down
Loading