DreamHost API Client for Node.js
Complete API client for DreamHost's API .
Ready for browser use if DreamHost ever enables CORS on their API.
Prerequisites
You'll need a DreamHost account, an API Key , and Node.js >= v4.
Installation
npm install --save dreamhost copy
Usage
Create a complete instance
const DreamHost = require ( 'dreamhost' );
const dreamHost = new DreamHost ({
key: '<your api key>'
});
// dreamHost will be initialized with all modules available, e.g.
dreamHost.dns. listRecords ()
. then (records => console. log (records))
. catch (err => console. error (err)) copy
Or create an instance of an individual API module:
const DNS = require ( 'dreamhost/dns' );
const dns = new DNS ({
key: '<your api key>'
});
dns. listRecords ()
. then (records => console. log (records))
. catch (err => console. error (err)) copy
API
All methods return a promise that resolves to the data field from the DreamHost API response.
Account
const DreamHost = require ( 'dreamhost' );
const dreamHost = new DreamHost ({key: '...' });
dreamHost.account. method (). then ( /*...*/ ); copy
or
const Account = require ( 'dreamhost/account' );
const account = new Account ({key: '...' });
account. method (). then ( /*...*/ ); copy
account.domainUsage(): Promise
Params:
Returned objects have the following fields:
account.listAccounts(): Promise
Params:
Returned objects have the following fields:
account_id
name
status
opened
yours
account.listKeys(): Promise
Params:
Returned objects have the following fields:
account.status(): Promise
Params:
Returned objects have the following fields:
account.userUsage(): Promise
Params:
Returned objects have the following fields:
AnnouncementList
const DreamHost = require ( 'dreamhost' );
const dreamHost = new DreamHost ({key: '...' });
dreamHost.announcementList. method (). then ( /*...*/ ); copy
or
const AnnouncementList = require ( 'dreamhost/announcement_list' );
const announcementList = new AnnouncementList ({key: '...' });
announcementList. method (). then ( /*...*/ ); copy
announcementList.addSubscriber(): Promise
See DreamHost's documentation for parameters and return details.
announcementList.listLists(): Promise
See DreamHost's documentation for parameters and return details.
announcementList.listSubscribers(): Promise
See DreamHost's documentation for parameters and return details.
announcementList.postAnnouncement(): Promise
See DreamHost's documentation for parameters and return details.
announcementList.removeSubscriber(): Promise
See DreamHost's documentation for parameters and return details.
Api
const DreamHost = require ( 'dreamhost' );
const dreamHost = new DreamHost ({key: '...' });
dreamHost.api. method (). then ( /*...*/ ); copy
or
const Api = require ( 'dreamhost/api' );
const api = new Api ({key: '...' });
api. method (). then ( /*...*/ ); copy
api.listAccessibleCmds(): Promise
Params:
Returned objects have the following fields:
api.listKeys(): Promise
Params:
Returned objects have the following fields:
key
created
comment
functions
Dns
const DreamHost = require ( 'dreamhost' );
const dreamHost = new DreamHost ({key: '...' });
dreamHost.dns. method (). then ( /*...*/ ); copy
or
const Dns = require ( 'dreamhost/dns' );
const dns = new Dns ({key: '...' });
dns. method (). then ( /*...*/ ); copy
dns.addRecord(): Promise
See DreamHost's documentation for parameters and return details.
dns.listRecords(): Promise
See DreamHost's documentation for parameters and return details.
dns.removeRecord(): Promise
See DreamHost's documentation for parameters and return details.
Domain
const DreamHost = require ( 'dreamhost' );
const dreamHost = new DreamHost ({key: '...' });
dreamHost.domain. method (). then ( /*...*/ ); copy
or
const Domain = require ( 'dreamhost/domain' );
const domain = new Domain ({key: '...' });
domain. method (). then ( /*...*/ ); copy
domain.listCertificates(): Promise
Params:
Returned objects have the following fields:
domain
type
signed
expires
on_order
domain.listDomains(): Promise
Params:
Returned objects have the following fields:
account_id
domain
home
type
unique_ip
hosting_type
user
path
outside_url
www_or_not
php
security
fastcgi
xcache
php_fcgid
passenger
domain.listRegistrations(): Promise
Params:
Returned objects have the following fields:
account_id
domain
expires
created
modified
autorenew
locked
expired
ns1
ns2
ns3
ns4
registrant
registrant_org
registrant_street1
registrant_street2
registrant_city
registrant_state
registrant_zip
registrant_country
registrant_phone
registrant_fax
registrant_email
tech
tech_org
tech_street1
tech_street2
tech_city
tech_state
tech_zip
tech_country
tech_phone
tech_fax
tech_email
billing
billing_org
billing_street1
billing_street2
billing_city
billing_state
billing_zip
billing_country
billing_phone
billing_fax
billing_email
admin
admin_org
admin_street1
admin_street2
admin_city
admin_state
admin_zip
admin_country
admin_phone
admin_fax
admin_email
domain.registrationAvailable(): Promise
Params:
Returned objects have the following fields:
Jabber
const DreamHost = require ( 'dreamhost' );
const dreamHost = new DreamHost ({key: '...' });
dreamHost.jabber. method (). then ( /*...*/ ); copy
or
const Jabber = require ( 'dreamhost/jabber' );
const jabber = new Jabber ({key: '...' });
jabber. method (). then ( /*...*/ ); copy
jabber.addUser(): Promise
Params:
username : required
domain : required
password : required
Returned objects have the following fields:
jabber.deactivateUser(): Promise
Params:
username : required
domain : required
Returned objects have the following fields:
jabber.listUsers(): Promise
Params:
Returned objects have the following fields:
username
domain
password
status
jabber.listUsersNoPw(): Promise
Params:
Returned objects have the following fields:
jabber.listValidDomains(): Promise
Params:
Returned objects have the following fields:
jabber.reactivateUser(): Promise
Params:
username : required
domain : required
Returned objects have the following fields:
jabber.removeUser(): Promise
Params:
username : required
domain : required
Returned objects have the following fields:
Mail
const DreamHost = require ( 'dreamhost' );
const dreamHost = new DreamHost ({key: '...' });
dreamHost.mail. method (). then ( /*...*/ ); copy
or
const Mail = require ( 'dreamhost/mail' );
const mail = new Mail ({key: '...' });
mail. method (). then ( /*...*/ ); copy
mail.addFilter(): Promise
See DreamHost's documentation for parameters and return details.
mail.listFilters(): Promise
See DreamHost's documentation for parameters and return details.
mail.removeFilter(): Promise
See DreamHost's documentation for parameters and return details.
Mysql
const DreamHost = require ( 'dreamhost' );
const dreamHost = new DreamHost ({key: '...' });
dreamHost.mysql. method (). then ( /*...*/ ); copy
or
const Mysql = require ( 'dreamhost/mysql' );
const mysql = new Mysql ({key: '...' });
mysql. method (). then ( /*...*/ ); copy
mysql.addHostname(): Promise
See DreamHost's documentation for parameters and return details.
mysql.addUser(): Promise
See DreamHost's documentation for parameters and return details.
mysql.listDbs(): Promise
See DreamHost's documentation for parameters and return details.
mysql.listHostnames(): Promise
See DreamHost's documentation for parameters and return details.
mysql.listUsers(): Promise
See DreamHost's documentation for parameters and return details.
mysql.removeHostname(): Promise
See DreamHost's documentation for parameters and return details.
mysql.removeUser(): Promise
See DreamHost's documentation for parameters and return details.
Oneclick
const DreamHost = require ( 'dreamhost' );
const dreamHost = new DreamHost ({key: '...' });
dreamHost.oneclick. method (). then ( /*...*/ ); copy
or
const Oneclick = require ( 'dreamhost/oneclick' );
const oneclick = new Oneclick ({key: '...' });
oneclick. method (). then ( /*...*/ ); copy
oneclick.catalog(): Promise
Params:
Returned objects have the following fields:
app_id
name
version
developer
install_mode
rating
num_ratings
oneclick.describeApp(): Promise
Params:
Returned objects have the following fields:
app_id
name
version
latest_version
developer
excerpt
tags
install_mode
rating
num_ratings
oneclick.destroyCustom(): Promise
Params:
install_id : required
deletefiles : required
oneclick.installCustom(): Promise
Params:
app_id : required
url : required
database : optional
repository : optional
Returned objects have the following fields:
oneclick.listCustom(): Promise
Params:
Returned objects have the following fields:
app_id
install_id
url
last_updated
update_setting
update_available
oneclick.update(): Promise
Params:
Returned objects have the following fields:
oneclick.updateAll(): Promise
Params:
Returned objects have the following fields:
Rewards
const DreamHost = require ( 'dreamhost' );
const dreamHost = new DreamHost ({key: '...' });
dreamHost.rewards. method (). then ( /*...*/ ); copy
or
const Rewards = require ( 'dreamhost/rewards' );
const rewards = new Rewards ({key: '...' });
rewards. method (). then ( /*...*/ ); copy
Params:
code : required
description : required
bonus_domregs : required
bonus_ips : required
discount_month : required
discount_1year : required
discount_2year : required
Params:
Params:
Params:
Returned objects have the following fields:
code
description
created
status
used
Params:
Returned objects have the following fields:
code
description
status
discount_month
discount_1year
discount_2year
bonus_domregs
bonus_ips
rewards.referralLog(): Promise
Params:
Returned objects have the following fields:
click_time
ip
code
signup_time
ref_url
webid
status
rewards.referralSummary(): Promise
Params:
Returned objects have the following fields:
code
signups
raw_clicks
unique_clicks
conversion
Params:
Services
const DreamHost = require ( 'dreamhost' );
const dreamHost = new DreamHost ({key: '...' });
dreamHost.services. method (). then ( /*...*/ ); copy
or
const Services = require ( 'dreamhost/services' );
const services = new Services ({key: '...' });
services. method (). then ( /*...*/ ); copy
services.flvencoder(): Promise
Params:
services.progress(): Promise
Params:
Returned objects have the following fields:
status
scheduled
executed
finished
User
const DreamHost = require ( 'dreamhost' );
const dreamHost = new DreamHost ({key: '...' });
dreamHost.user. method (). then ( /*...*/ ); copy
or
const User = require ( 'dreamhost/user' );
const user = new User ({key: '...' });
user. method (). then ( /*...*/ ); copy
user.addUser(): Promise
Params:
type : required
username : required
gecos : required
server : optional
shell_type : optional
password : optional
enhanced_security : optional
Returned objects have the following fields:
user.listUsers(): Promise
Params:
Returned objects have the following fields:
account_id
username
type
shell
home
disk_used_mb
quota_mb
gecos
user.listUsersNoPw(): Promise
Params:
Returned objects have the following fields:
account_id
username
type
shell
home
disk_used_mb
quota_mb
gecos
user.removeUser(): Promise
Params:
username : required
type : optional
remove_all : optional