1.3.3 • Published 4 years ago

proxmox-client v1.3.3

Weekly downloads
3
License
GPL-3.0
Repository
github
Last release
4 years ago

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

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.2.0

4 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago