node-gandi

Node.js client for Gandi.net XML-RPC API.

node-gandi

Node.js client for Gandi.net XML-RPC API.

  $ npm install --save node-gandi

Start by instantiating a Gandi client

  var cli = require('node-gandi');
  var apikey = 'your-24-char-apikey';
 
  var gandi = new cli(apikey); // or new cli(apikey, true); for OT&E 

The client exposes four methods to use in your code.

Returns the result(s) of the API call to the method given in parameter.

  var gandi = new cli(apikey, true);
  var domain = 'pegase745.org';
 
  var cb = function(errdata) {
    if (data[domain] == 'pending') {
      console.log('result is not yet ready')
      setTimeout(function() {
        gandi.call('domain.available', [[domain]], cb);
      }, 700)
    }
    else {
      console.dir(data);
    }
  }
 
  gandi.call('domain.available', [[domain]], cb);

Returns the list of available methods in the API.

  var gandi = new cli(apikey, true);
 
  gandi.list(function(errdata) {
    if (err) throw err;
    console.log(data);
  });
 

Returns the signature of the API method given in parameter.

  var gandi = new cli(apikey, true);
 
  gandi.signature('domain.list', function(errdata) {
    if (err) throw err;
    console.log(data);
  });
 

Returns a help for the API method given in parameter.

  var gandi = new cli(apikey, true);
 
  gandi.help('domain.list', function(errdata) {
    if (err) throw err;
    console.log(data);
  });
 
  $ sudo ote_apikey=your-24-char-apikey npm test

MIT