Domains

Digital Ocean allows users to easily setup and control hostnames and subdomains for existing droplets. Simply point the DNS of your host provider to:

  • ns1.digitalocean.com
  • ns2.digitalocean.com
  • ns3.digitalocean.com

For full documentation on setup please read: How To Set Up a Host Name with DigitalOcean.

Creating Domains

domain = d0.create_domain(name='myurl.com',ip_addr='555.55.5.55')

#or with a droplet
droplet = d0.create_droplet(..)
domain = d0.create_domain(name='myurl.com',ip_addr=droplet.ip_address)

Getting a specific domain

droplet = d0.get_domain(domain_id=555555)

Getting all droplets

domains = d0.get_all_domains()

Droplet API

class doto.Domain(conn=None, **kwds)
destroy()

This method allows you to destroy a domain.

https://api.digitalocean.com/domains/[domain_id]/destroy/? client_id=[your_client_id]&api_key=[your_api_key]

edit_record(record_id=None, record_type=None, data=None, name=None, priority=None, port=None, weight=None)

This method edits an existing domain record.

Parameters:
  • record_id (int) – ID of record you are trying to retrieve.
  • record_type (String) – the type of record you would like to create. ‘A’, ‘CNAME’, ‘NS’, ‘TXT’, ‘MX’ or ‘SRV’.
  • data (String) – This is the value of the record.
  • name (String) – Required for ‘A’, ‘CNAME’, ‘TXT’ and ‘SRV’ records otherwise optional
  • priority (int) – required for ‘SRV’ and ‘MX’ records otherwise optional
  • port (int) – required for ‘SRV’ records otherwise optional
  • weight (int) – required for ‘SRV’ records. otherwise optional

https://api.digitalocean.com/domains/[domain_id]/records/[record_id]/edit? client_id=[your_client_id]&api_key=[your_api_key]

get_all_records(table=False)

This method returns all of your current domain records.

https://api.digitalocean.com/domains/[domain_id]/records? client_id=[your_client_id]&api_key=[your_api_key]

get_record(record_id=None)

This method returns the specified domain record.

Parameters:record_id (int) – ID of record you are trying to retrieve.

https://api.digitalocean.com/domains/[domain_id]/records/[record_id]? client_id=[your_client_id]&api_key=[your_api_key]

record_destroy(record_id=None)

This method deletes the specified domain record.

https://api.digitalocean.com/domains/[domain_id]/records/[record_id]/destroy? client_id=[your_client_id]&api_key=[your_api_key]