1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
| # 本接口 Record.List 用于获取解析记录列表。Record.Modify 用于修改解析记录。更多请查询:https:
# 首次需要获取子域名信息主要是需要records中的id,若Token的ID为【511314】且Token的值为【0123456789abcdefg】 curl -X POST "https://dnsapi.cn/Record.List" -d "login_token=511314,0123456789abcdefg&domain=test.com&sub_domain=file"
# 将获取的子域名JSON信息格式化输出如下: { "status": { "code": "1", "message": "操作已经成功完成", "created_at": "2025-02-07 22:34:26" }, "domain": { "id": "12345678", "name": "test.com", "punycode": "test.com", "grade": "DP_Free", "owner": "qcloud@qcloud.com", "ext_status": "", "ttl": 600, "min_ttl": 600, "dnspod_ns": [ "f1g1ns1.dnspod.net", "f1g1ns2.dnspod.net" ], "status": "enable", "can_handle_at_ns": true }, "info": { "sub_domains": "6", "record_total": "1", "records_num": "1" }, "records": [ { "id": "0987654321", # 需要这个值 "ttl": "600", "value": "240e:abc:def:ghij::1", "enabled": "1", "status": "enable", "updated_on": "2025-02-07 17:53:17", "record_type_v1": "1", "status_v1": "enabled", "enabled_v1": "1", "name": "file", "line": "默认", "line_id": "0", "type": "AAAA", "weight": null, "monitor_status": "", "remark": "", "use_aqb": "no", "mx": "0" } ] }
# 根据如下更新域名解析,需要上面查询到的record_id,假设要更新的IPv6地址为 240e:abc:def:ghij::1 curl -X POST "https://dnsapi.cn/Record.Modify" -d \ "login_token=511314,0123456789abcdefg&domain=leux.cn&sub_domain=cn&record_type=AAAA&record_line=默认&ttl=600&value=240e:abc:def:ghij::1&record_id=0987654321"
# 若成功更新的话返回值的JSON信息格式化输出应如下: { "status": { "code": "1", "message": "操作已经成功完成", "created_at": "2025-02-07 22:36:57" }, "record": { "id": 0987654321, "name": "file", "value": "240e:abc:def:ghij::1", "status": "enable", "weight": null } }
# 部分返回值所代表的意思,返回值请自行JSON格式化观看 "code": "1" "message": "操作已经成功完成" "code": "8" "message": "记录编号错误 record_id" "code": "34" "message": "记录的值不正确 value"
|