๐
Cpanel-node Cpanel-node is designed to be simplest way possible to make api request to Cpanel.
๐
Installation $ npm install cpanel-node
๐ฌ
Usage const cpanelAPI = require('cpanel-node');
const options = {
host: 'whm.example.com',
user: 'CPANEL_USERNAME',
pass: 'CPANEL_PASSWORD',
https: true, //https is advisable
port: "2083" //default port of cpanel
};
let myCpanel = new cpanelAPI(options);
๐จ
API Create email address
myCpanel.emailAddpop({
domain: 'example.com',
email: "thebest",
password: "*******",
quota: 150 //Mo
}).then(obj => {
console.log(obj.response);
console.log(obj.header);
});
Remove email address
myCpanel.emailDelpop({
domain: 'example.com',
email: 'thebest'
}).then(obj => {
console.log(obj.response);
console.log(obj).header);
});
Change email password
myCpanel.emailPasswdpop({
domain: 'example.com',
email: "thebest",
password: "*******"
}).then(obj => {
console.log(obj.response);
console.log(obj.header);
});
Change email quota
myCpanel.emailEditpopQuota({
domain: 'example.com',
email: "thebest",
quota: 50//Mo
}).then(obj => {
console.log(obj.response);
console.log(obj.header);
});
Retrieve a zone file
myCpanel.zoneFetchZone({
domain: 'example.com',
name: "world",
type: "type"
}).then(obj => {
console.log(obj.response);
console.log(obj.header);
});
Get all of the account's zone files
myCpanel.zoneFetchZones().then(obj => {
console.log(obj.response);
console.log(obj.header);
});