#!/bin/bash
domain=mydomain
subdomain=qq1234
temp=$(curl https://www.cloudflare.com/api_json.html -d 'a=rec_load_all' \
-d 'tkn=CloudFlare_API_Key' \
-d 'email=CloudFlare_Email_Address' \
-d "z=$mydomain.com")
id=$(echo $temp | python -m json.tool|grep -B4 -A23 "\"$subdomain\""|grep 'rec_id'|awk -F'"' '{print $4}')
echo "$subdomain id = $id"
2017年6月8日
用 shell script 直接取得 cloudflare 上需要的 sub domain rec_id
2016年10月16日
使用 shell script 刪除 cloudflare 上的快取
1.先取得 domain name 的 ID
X-Auth-Email: 使用帳號
X-Auth-Key: API KEY 在 My settings 裡面可以查看
2.執行後會取得一連串的 json 字串、可以用線上 JSON檢視工具 直接看
3.取得後寫成shell script執行就好了
curl -X GET "https://api.cloudflare.com/client/v4/zones?name=網址" \
# -H "X-Auth-Email: test@gmail.com" \
# -H "X-Auth-Key: 7b9fb4xxxxxxxxxxxxxxxxxxxxxxxxxx" \
# -H "Content-Type: application/json" \
X-Auth-Email: 使用帳號
X-Auth-Key: API KEY 在 My settings 裡面可以查看
2.執行後會取得一連串的 json 字串、可以用線上 JSON檢視工具 直接看
3.取得後寫成shell script執行就好了
curl -X DELETE "https://api.cloudflare.com/client/v4/zones/e74b73xxxxxxxxxxxxxxxxxxxxxxxxxx/purge_cache" \
-H "X-Auth-Email: test@gmail.com" \
-H "X-Auth-Key: 7b9fb4xxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
訂閱:
文章 (Atom)
