netcupdns
Version:
minimal JS wrapper for netcup DNS settings; easy dyndns;
50 lines (38 loc) • 1.83 kB
Markdown
# netcupdns
*This project is not affiliated with the company netcup GmbH.*
javascript/nodejs wrapper for the **netcup** dns api
# Usage
## Install
```
npm i netcupdns
```
## Basic Example
```javascript
const netcupdns = require('netcupdns');
main();
async function main() {
let sessionCredentials = await netcupdns.getSessionCredentials(YOURAPIKEY, YOURAPIPASSWORD, YOURCUSTOMERNUMBER);
console.log(await netcupdns.infoDnsRecords(sessionCredentials, YOURDOMAIN));
}
```
## Functions
every return is async and has to be awaited with the await keyword
```javascript
/* returns the session credentials; takes the apikey apipassword and customernumber;
you cand find the api details on netcup>ccp>stammdaten>api(top right corner) */
getSessionCredentials(apikey, apipassword, customernumber)
//takes sessionCredentials and domainname; returns array of present dns record for a domain
infoDnsRecords(sessionCredentials, domainname)
//takes record and inserts it; if record already exists (judged by hostname) it overwrites it
insertOrOverwriteRecords(sessionCredentials, domainname, record)
//inserts dns record without checking if it already exists; returns array of updated dns records;
updateDnsRecords(sessionCredentials, domainname, dnsrecords)
//takes single hostname as string; ('mail');returns array of matching records
getRecordsByHostname(sessionCredentials, domainname, hostname)
//takes single type as string; ('AAAA'); returns array of matching records
getRecordsByType(sessionCredentials, domainname, type)
//takes destination as string; returns array with ids of matching records
getRecordsByDestination(sessionCredentials, domainname, destination)
//takes array of records and deletes them;
deleteRecords(sessionCredentials, domainname, recordsToDelete)
```