使用Cloudflare API动态解析域名IP
总的来说,分2步,先获取zoneid, 然后在获取dnsid, 然后设置对应dnsid的内容准备
在cloudflare创建要解析的二级域名
获取账号X-Auth-Key
登录cloudflare后,右上角->头像->我的个人资料->API令牌->Global API Key->查看
开始
获取zoneID(zone_identifier)curl -X GET "https://api.cloudflare.com/client/v4/zones" \
-H "X-Auth-Email: 账号邮箱" \
-H "X-Auth-Key: 准备中获取的令牌\
-H "Content-Type: application/json"获取域名记录IDcurl -X GET "https://api.cloudflare.com/client/v4/zones/zoneID/dns_records?page=1&per_page=20&order=type&direction=asc" \
-H "Content-Type:application/json" \
-H "X-Auth-Key: 准备中获取的令牌" \
-H "X-Auth-Email: 账号邮箱"找到你要解析的域名记录ID,备用
更新解析curl -X PUT "https://api.cloudflare.com/client/v4/zones/zoneID/dns_records/域名记录ID" \
-H "X-Auth-Email: 账号邮箱" \
-H "X-Auth-Key: 准备中获取的令牌" \
-H "Content-Type: application/json" \
--data '{"type":"A","name":"记录值(www.abc.com)","content":"127.0.0.1","ttl":120,"proxied":false}'
页:
[1]