TA的每日心情 | 开心 昨天 22:18 |
---|
签到天数: 1645 天 [LV.Master]伴坛终老
|
总的来说,分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"
复制代码 获取域名记录ID- curl -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}'
复制代码 |
|