dynect-api
Version:
A barely functional, yet servicable, Dynect Managed DNS REST API Interface
50 lines (38 loc) • 1.1 kB
Markdown
- `npm i dynect-api`
- `git clone https://github.com/TheNorthRemembers/dynect-api.git` and then `npm run build`
All calls return Promises and are `async` and awaitable.
```
const Dynect = require('dynect-api');
// initialize
Dynect.init({
customer_name: 'Customer Name',
user_name: 'Dynect Username',
password: 'Dynect Password',
});
// login
await Dynect.login().catch((err) => {
// do something on error
});
// get all zones
const zones = await request('/Zone', 'GET', null).then((response) => {
// do something with response if you want before returning it
}).catch((err) => {
// do something with an error
});
```
To make a request
```
const response = await request(apiPath, method, data);
```
There are a few wrapper functions
```
const zones = await Dynect.getZones();
const zone = await Dynect.getZone(zonePath);
```
[](https://help.dyn.com/rest-resources-by-topic/)