You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
880 B
36 lines
880 B
//NodeJS Script
|
|
//You must have the axios module installed
|
|
const axios = require('axios')
|
|
const querystring = require('querystring');
|
|
|
|
//Admin Credentials
|
|
const hst_hostname = 'server.hestiacp.com'
|
|
const hst_port = 8083
|
|
const hst_username = 'admin'
|
|
const hst_password = 'p4ssw0rd'
|
|
const hst_returncode = 'yes'
|
|
const hst_command = 'v-add-domain'
|
|
|
|
//Domain details
|
|
const username = 'demo'; //username to associate the domain
|
|
const domain = 'domain.tld'; //domain
|
|
|
|
const data_json = {
|
|
'user': hst_username,
|
|
'password': hst_password,
|
|
'returncode': hst_returncode,
|
|
'cmd': hst_command,
|
|
'arg1': username,
|
|
'arg2': domain
|
|
}
|
|
|
|
const data = querystring.stringify(data_json)
|
|
|
|
axios.post('https://'+hst_hostname+':'+hst_port+'/api/', data)
|
|
.then(function (response) {
|
|
console.log(response.data);
|
|
console.log("0 means successful")
|
|
})
|
|
.catch(function (error) {
|
|
console.log(error);
|
|
}); |