proxmox-client
v1.3.3
Published
A client for the proxmox api
Downloads
22
Readme
proxmox-client
A node.js client for the Proxmox API
(Get) Usage example
const proxmox = require('proxmox-client');
proxmox.auth('localhost:8006', 'root@pam!testToken', 'token').then(() => {
proxmox.get('/nodes').then((res) => {
if(res.status !== 200) {
console.log("statusCode is not 200");
}
res = JSON.parse(res.text).data;
console.log(res);
})
.catch((err) => {
console.log('Error:', err);
});
}).catch((err) => {
console.log(err);
});
(Post) Usage example
const proxmox = require('proxmox-client');
proxmox.auth('localhost:8006', 'root@pam!testToken', 'token').then(() => {
proxmox.post('/nodes/testnode/qemu/100/status/reboot', {timeout: 1500}).then((res) => {
if(res.status !== 200) {
console.log("statusCode is not 200");
}
res = JSON.parse(res.text).data;
console.log(res);
})
.catch((err) => {
console.log('Error:', err);
});
}).catch((err) => {
console.log(err);
});
});
API
proxmox.auth(host, user, tokenName, token, realm = 'pam'): Promise
Stores the auth information
proxmox.auth(host, tokenInfo, token): Promise
Stores the auth information
proxmox.get(path): Promise
Sends a GET Request to the defined path and returns a superagent request
proxmox.post(path, body): Promise
Sends a POST Request to the defined path with the defined body and returns a superagent request
proxmox.put(path, body): Promise
Sends a PUT Request to the defined path with the defined body and returns a superagent request
proxmox.delete(path): Promise
Sends a DELETE Request to the defined path and returns a superagent request
proxmox.del(path): Promise
Sends a DELETE Request to the defined path and returns a superagent request
Debugging
You can enable the debug outputs by setting the DEBUG environment variable to 'proxmox:*'.
License
GPL-3.0