1.0.12 • Published 10 years ago

dnspod-api v1.0.12

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

dnspod-api

A dnspod api for nodejs. (使用最新认证方式,兼容DNSPOD国际版和国内版)

Features

  • For dnspod.com or dnspod.cn.

  • Multiple-instance.

  • Implementation by promise.

  • Use login token replace user & password auth.

DNSPOD API documents

The actions and params that you can find.

Dnspod.cn : https://www.dnspod.cn/docs
Dnspod.com : https://www.dnspod.com/docs

How to get token

First of all, you should get the login token.

Dnspod.cn : https://support.dnspod.cn/Kb/showarticle/tsid/227
Dnspod.com : https://www.dnspod.com/docs/info.html#get-the-user-token

Install

npm install dnspod-api -g

Useage

BIN Example

dnspod-api --token 'xxxxx,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' --action 'Domain.List'

or

dnspod-api -s 'dnspod.cn' -t 'xxxxx,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' -a 'Record.List' -p '{"domain": "your-domain.com", "sub_domain": "@"}'

Warning: If the token string have $, please replace it with \$.

API Example

// require
var DnspodApi = require('dnspod-api');

// new dnspodApi instance
var dnspodApi =  new DnspodApi({
    server : 'dnspod.cn', // which server you are using . dnspod.com (default) | dnspod.cn
    token : 'xxxxx,xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' // your login token, you can find how to get this at the top.
});

// do actions
dnspodApi.do({
    action : 'Domain.List' // the api action
})
.then(
    // success
    function(domainListData){
        
        console.log('Domain List: ', domainListData);
        
        return dnspodApi.do({
            action : 'Record.List',
            // the api params
            params : {
                domain : 'your-domain.com',
                sub_domain : '@'
            }
        });

    },
    // error
    function(error) {
        console.log(error);
    }
)
.then(
    function(recordListData){
        console.log('Record List: ', recordListData);
        console.log('The Arguments: ', recordListData.args);
    },
    // error
    function(error) {
        console.log(error);
        console.log('The Arguments: ', error.args);
    }
)
//.then ....
1.0.12

10 years ago

1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

0.0.1

10 years ago