Wrapper for DNSimple API
This is an unofficial DNSimple API module for node.js. You need a DNSimple account to use this.
npm install dnsimple
See Configuration below for details.
var dnsimple = 'dnsimple' email: 'email@example.com' token: 'abc123' ;// Add a domain namevar input =domain: name: 'example.tld';dnsimple 'POST' '/domains' inputif errreturn console.log err;console.log datadomainname + ' created with ID ' + datadomainid;;
More examples: https://github.com/fvdm/nodejs-dnsimple/wiki
This module supports multiple authentication methods. None of them is totally secure, but some are easier to reset.
Most secure, easy to reset at dnsimple.com/account.
var dnsimple = require 'dnsimple'email: 'firstname.lastname@example.org'token: '12345abcde';
var dnsimple = require 'dnsimple'email: 'email@example.com'password: 'secret';
Access to only one domain name, easy to reset.
var dnsimple = require 'dnsimple'domainToken: 'abc123';
When you have set up two-factor authentication for your account the module returns
twoFactorOTP missing when you did not provide your one-time password.
First your need to tell the API once your one-time code from Authy or SMS, by
defining it during setup along with your
password and calling a random
method. Then the API returns a token which you can use instead of your email and password.
// Set the OTP code on loadvar dnsimple = require 'dnsimple'email: 'firstname.lastname@example.org'password: 'my-secret'twoFactorOTP: '0123456';// Now call a random method to trade the OTP for a longterm tokendnsimple 'GET' '/subscription'if err return console.log err;console.log 'Two-factor token: '+ metatwoFactorToken;;// From now on only use this token - no email/passwordvar dnsimple = require 'dnsimple'twoFactorToken: '22596363b3de40b06f981fb85d82312e';
When loading the module into your code you need to provide an Object for authentication as described above. This object can have a few more settings.
|Account email address|
|token||Account access token|
|domainToken||Domain specific API access token|
|twoFactorOTP||One-time code, i.e. Authy|
|twoFactorToken||Login token, from
|timeout||End API call after this amount of ms||30000|
To use the sandbox environment set
( method, path, [params], callback )
The module is only one method which takes care of all the error handling and basic post-processing.
See the API documentation for details on each method.
|method||string||yes||GET, POST, PUT, DELETE|
|callback||function||yes||Function to receive response|
The last argument
callback receives three arguments:
When an error occurs
err is an instance of Error and
data is null.
err can have additional properties.
When everything is good
err will be null and
data will be the parsed result.
meta parameter is always available and contains extra information from
the API, such as statusCode, request_id, runtime and twoFactorToken.
datais boolean true on success, false otherwise.
err.message can be any of these:
|credentials missing||No authentication details set|
|request failed||The request cannot be made||
|invalid reponse||Invalid API response||
|API error||The API returned an error||
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to http://unlicense.org/