Cloudflare

Apache, Nginx and other
Ответить
brahman
Site Admin
Сообщения: 60
Зарегистрирован: 30 май 2020, 13:42

Cloudflare

Сообщение brahman »

Cloudflare delete all DNS records, from bash:

Код: Выделить всё

#!/bin/bash

TOKEN="xxxxxxxxxxxxxxxxxxx"
ZONE_ID=2222222222222222222222222

# [email protected]
# KEY=11111111111111111111111111
# Replace with 
#     -H "X-Auth-Email: ${EMAIL}" \
#     -H "X-Auth-Key: ${KEY}" \
# for old API keys
 

curl -s -X GET https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records?per_page=500 \
    -H "Authorization: Bearer ${TOKEN}" \
    -H "Content-Type: application/json" | jq .result[].id |  tr -d '"' | (
  while read id; do
    curl -s -X DELETE https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records/${id} \
      -H "Authorization: Bearer ${TOKEN}" \
      -H "Content-Type: application/json"
  done
  )

Ответить