获取domain id
可以按格式显示
curl https://dnsapi.cn/Domain.List -d "login_token=toker_ID,token&format=json"
{"status":{"code":"1","message":"Action completed successful","created_at":"2018-11-25 22:22:54"},"info":{"domain_total":4,"all_total":4,"mine_total":4,"share_total":"0","vip_total":0,"ismark_total":0,"pause_total":0,"error_total":0,"lock_total":0,"spam_total":0,"vip_expire":0,"share_out_total":0},"domains":[{"id":domain id,"status":"enable","grade":"DP_Free","group_id":"1","searchengine_push":"no","is_mark":"no","ttl":"600","cname_speedup":"disable","remark":"","created_on":"2018-11-25 00:28:40","updated_on":"2018-11-25 00:28:40","punycode":"域名","ext_status":"","src_flag":"QCLOUD","name":"域名","grade_title":"\u65b0\u514d\u8d39\u5957\u9910","is_vip":"no","owner":"用户名","records":"9"},{"id":domain id,"status":"enable","grade":"DP_Free","group_id":"1","searchengine_push":"no","is_mark":"no","ttl":"600","cname_speedup":"disable","remark":"","created_on":"2018-11-25 00:06:58","updated_on":"2018-11-25 00:06:58","punycode":"ccoo.ga","ext_status":"","src_flag":"DNSPOD","name":"ccoo.ga","grade_title":"\u65b0\u514d\u8d39\u5957\u9910","is_vip":"no","owner":"用户名","records":"2"},{"id":domain id,"status":"enable","grade":"DP_Free","group_id":"1","searchengine_push":"no","is_mark":"no","ttl":"600","cname_speedup":"disable","remark":"","created_on":"2018-11-25 00:05:01","updated_on":"2018-11-25 00:05:01","punycode":"mufo.ml","ext_status":"","src_flag":"DNSPOD","name":"mufo.ml","grade_title":"\u65b0\u514d\u8d39\u5957\u9910","is_vip":"no","owner":"用户名","records":"2"},{"id":domain id,"status":"enable","grade":"DP_Free","group_id":"1","searchengine_push":"no","is_mark":"no","ttl":"600","cname_speedup":"disable","remark":"","created_on":"2018-11-23 22:41:43","updated_on":"2018-11-23 22:41:43","punycode":"uedu.ml","ext_status":"","src_flag":"DNSPOD","name":"uedu.ml","grade_title":"\u65b0\u514d\u8d39\u5957\u9910","is_vip":"no","owner":"用户名","reco
也可以更改为其它格式的显示:
https://dnsapi.cn/Domain.List -d "login_token=toker_ID,token&format=yaml"
1
Action completed successful
2018-11-25 22:25:57
4
4
4
0
0
0
0
0
0
0
0
0
-
domain id
enable
DP_Free
1
no
no
600
disable
2018-11-25 00:28:40
2018-11-25 00:28:40
域名
QCLOUD
域名
no
用户名
9
-
domain id
enable
DP_Free
1
no
no
600
disable
2018-11-25 00:06:58
2018-11-25 00:06:58
ccoo.ga
DNSPOD
域名
no
用户名
2
-
domain id
enable
DP_Free
1
no
no
600
disable
2018-11-25 00:05:01
2018-11-25 00:05:01
mufo.ml
DNSPOD
域名
no
用户名
2
-
domain id
enable
DP_Free
1
no
no
600
disable
2018-11-23 22:41:43
2018-11-23 22:41:43
uedu.ml
DNSPOD
域名
no
用户名
6
获取record line id
curl -X POST https://dnsapi.cn/Record.List -d 'login_token=toker_ID,token&format=json&domain_id=domain id&sub_domain=r&record_type=A&offset=0&length=3'
{"status":{"code":"1","message":"Action completed successful","created_at":"2018-11-25 22:36:22"},"domain":{"id":domain id,"name":"域名","punycode":"域名","grade":"DP_Free","owner":"用户名","ext_status":"","ttl":600,"min_ttl":600,"dnspod_ns":["f1g1ns1.dnspod.net","f1g1ns2.dnspod.net"],"status":"enable"},"info":{"sub_domains":"9","record_total":"1","records_num":"1"},"records":[{"id":"record id","ttl":"600","value":"IP","enabled":"1","status":"enabled","updated_on":"2018-11-25 15:40:22","name":"主机名或者子域名","line":"\u9ed8\u8ba4","line_id":"0","type":"A","weight":null,"monitor_status":"","remark":"","use_aqb":"no","mx":"0"}]}
更新动态ddns
curl -X POST https://dnsapi.cn/Record.Ddns -d 'login_token=toker_ID,token&format=json&domain_id=domain id&record_id=393227622&record_line_id=0&sub_domain=r'
梅林固件添加自动更新脚本:
vi /jffs/scripts/ddns-start
#!/bin/sh
curl -X POST https://dnsapi.cn/Record.Ddns -d 'login_token=toker_ID,token&format=json&domain_id=domain id&record_id=record_id&record_line_id=0&sub_domain=r'
if [ $? -eq 0 ]; then
/sbin/ddns_custom_updated 1
else
/sbin/ddns_custom_updated 0
fi
chmod +x /jffs/scripts/ddns-start
官方API文档:
http://www.dnspod.cn/docs/records.html#dns