DNS Methods

API for DNS

This provides an API for the Memset DNS (Domain Name Service).

The Memset DNS API has three main objects
  • A zone domain
  • A zone record
  • A zone

A zone is composed of a number of zone domains and a number of zone records. The zone domains specify which domains the nameservers will return this zone for, and the zone records specify which records are returned.

Zone records are usually relative, which means that they have the zone domain appended to them. If you make a zone record with name or www and a domain of example.com then the record will be served for queries matching www.example.com. If you were to add example.co.uk to the zone domains for this zone then www.example.co.uk would be served with the same value.

Zone records are relative if the relative flag is True. If the relative flag is False and the name contains dots, then they are treated as absolute, otherwise they are treated as relative. For example if you make a zone record with name www.example.com it will be served under any domain as www.example.com, however if you set the relative flag to True it will be served under the domain specified. The relative flag is essential if you want to host zones under multiple domains where part of the name contains dots, e.g. if name was a.www and domain was example.com then you would need to set the relative flag in the zone record if you wanted it served as a.www.example.com rather than a.www.

dns.reload()

Reloads the name servers with recent changes.

Running this will ensure that the current state of your DNS records is synced with your DNS server. DNS records are pushed out the the server every 15 minutes normally, but running this will speed up the process.

You may poll the job returned to discover when this has been done. We don’t guarantee any particular timescale for this, but normally it will only take a few seconds.

Returns:A dictionary as described in job.status().
dns.reverse_map_list()

Query the reverse maps for all servers, or a single server if name is supplied, or a single address if address is supplied. If name and address are supplied then it will only show address if it is attached to that server.

Parameters:
  • name (String, Optional) – Name of the server. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • address (String, Optional) – The IPv4 or IPv6 address to list. Ensure this value has at most 250 characters.
Returns:

a list of dictionary with the following keys:

name

String: Which server name this is attached to

address

String: IPv4 or IPv6 address

reverse_map

String: what this IP address reverse maps to

dns.reverse_map_update()

Updates a reverse map. If name is supplied then it checks that address is attached to that server before updating it.

Parameters:
  • name (String, Optional) – Name of the server. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • address (String) – The IPv4 or IPv6 address to change the reverse map for. Ensure this value has at most 250 characters.
  • reverse_map (String) – The name this IP address reverse maps to. Must be a valid hostname. Ensure this value has at most 250 characters.
Returns:

a list of dictionaries as described in dns.reverse_map_list().

dns.zone_create()

Create a zone, optionally providing records and domains.

Parameters:
  • nickname (String) – A customer specified name for the zone file. Not guaranteed unique. Ensure this value has at most 250 characters.
  • ttl (Integer, Optional) –

    Time to live - 0 for use this zone’s default TTL. Acceptable values

    0
    Default
    300
    5 minutes
    600
    10 minutes
    900
    15 minutes
    1800
    30 minutes
    3600
    1 hour
    7200
    2 hours
    10800
    3 hours
    21600
    6 hours
    43200
    12 hours
    86400
    24 hours
  • records (List, Optional) – A List of Dictionaries describing zone records to create as described in dns.zone_record_create(). Note that the dictionaries shouldn’t include the zone_id parameter as this will be automatically inserted.
  • domains (List, Optional) – A List of Dictionaries describing zone domains to create as described in dns.zone_domain_create(). Note that the dictionaries shouldn’t include the zone_id parameter as this will be automatically inserted.
Returns:

a dictionary with information about the created zone as decribed in dns.zone_info().

dns.zone_delete()

Deletes a zone

NB this will delete any zone records and zone domains that are part of this zone.

Parameters:id (String) – The Zone ID. Zone IDs are 32 hex digits.
Returns:a dictionary with zone in before it was deleted as returned by dns.zone_info()
dns.zone_domain_create()

Create a zone domain.

Parameters:
  • domain (String) – The zone domain name. Ensure this value has at most 250 characters.
  • zone_id (String, Optional) – The Zone ID. Zone IDs are 32 hex digits.
Returns:

a dictionary containing the contents of the zone domain after addition as described in dns.zone_domain_info().

dns.zone_domain_delete()

Deletes the zone domain

Parameters:domain (String) – The zone domain name. Ensure this value has at most 250 characters.
Returns:a dictionary containing the contents of the zone domain before it was deleted as described in dns.zone_domain_info().
dns.zone_domain_info()

Info about a zone domain

Parameters:domain (String) – The zone domain name. Ensure this value has at most 250 characters.
Returns:a dictionary with the following keys
domain
String: The domain name in question, e.g. ‘example.com’
zone_id
String, Optional: zone id (32 hex digits) that this domain is part of. If it isn’t present then this domain is not part of a zone, or part of a zone you can’t change.
dns.zone_domain_list()

Returns all the zone domains for this account

Returns:list of dictionaries as described in dns.zone_domain_info().
dns.zone_domain_update()

Updates the zone domain.

Parameters:
  • domain (String) – The zone domain name. Ensure this value has at most 250 characters.
  • zone_id (String, Optional) – The Zone ID. Zone IDs are 32 hex digits.
Returns:

a dictionary containing the contents of the zone domain after addition as described in dns.zone_domain_info().

dns.zone_info()

Info about a zone

Parameters:id (String) – The Zone ID. Zone IDs are 32 hex digits.
Returns:a dictionary with the following keys
id
String: zone id (32 hex digits).
nickname
String: your name for this zone
ttl
Integer: the default TTL for records in this zone in seconds, 0 means use Memset default of 1800 seconds.
records
List: a list of dictionaries describing zone records that are used in this zone dns.zone_record_info().
domains
List: a list of dictionaries describing zone domains that are used for this zone see dns.zone_domain_info().
dns.zone_list()

Lists all the zones in this account

Returns:a list of dictionaries as described in zone_info()
dns.zone_record_create()

Create a zone record in the zone supplied

Parameters:
  • zone_id (String) – The Zone ID. Zone IDs are 32 hex digits.
  • type (String) – Domain record type, e.g. ‘A’. Acceptable values: ‘A’, ‘AAAA’, ‘CNAME’, ‘MX’, ‘NS’, ‘SRV’, ‘TXT’.
  • record (String, Optional) – Name of record, e.g. ‘www’. Use the empty string ‘’ to create a record for the domain itself. Must be a valid zone record name. Ensure this value has at most 250 characters.
  • address (String) – Address of record, e.g. ‘1.2.3.4’. Only printable ASCII characters are allowed. Ensure this value has at most 250 characters.
  • ttl (Integer, Optional) –

    Time to live - 0 for use this zone’s default TTL. Acceptable values

    0
    Default
    300
    5 minutes
    600
    10 minutes
    900
    15 minutes
    1800
    30 minutes
    3600
    1 hour
    7200
    2 hours
    10800
    3 hours
    21600
    6 hours
    43200
    12 hours
    86400
    24 hours
  • priority (Integer, Optional) – Priority for MX and SRV records, eg 10. Ensure this value is greater than or equal to 0. Ensure this value is less than or equal to 999.
  • relative (Boolean, Optional) – If set then we add the current domain onto the address field for CNAME, MX, NS and SRV record types.
Returns:

a dictionary with the zone record in as described in dns.zone_record_info()

dns.zone_record_delete()

Delete a zone record

Parameters:id (String) – The Zone Record ID. Zone Record IDs are 32 hex digits.
Returns:the zone record information before it was deleted as a dictionary as described in dns.zone_record_info().
dns.zone_record_info()

Info about a zone record

Parameters:id (String) – The Zone Record ID. Zone Record IDs are 32 hex digits.
Returns:a dictionary with the following keys
id
String: id (32 hex digits) of this zone record
zone_id
String: zone id (32 hex digits) that this zone record is part of.
type
String: Domain record type: ‘A’, ‘AAAA’, ‘CNAME’, ‘MX’, ‘NS’, ‘SRV’, ‘TXT’
record
String: Name of record, e.g. ‘www’
address
String: Address of record, e.g. ‘1.2.3.4’
ttl
Integer: Time to live - 0 for use this zone’s default TTL
priority
Integer: Priority for MX and SRV records, e.g. 10, not used for other record types
relative
Boolean: If true we never assume the name is absolute. Normally if the name does not contain any dots we assume it is relative to the current domain. The domain is added for CNAME, MX, NS and SRV record types which are deemed to be relative.
dns.zone_record_list()

Returns all the zone records for this account

Returns:list of dictionaries as described in dns.zone_record_info().
dns.zone_record_update()

Update a zone record. Supply any parameters you want updated.

Parameters:
  • id (String) – The Zone Record ID. Zone Record IDs are 32 hex digits.
  • zone_id (String, Optional) – The Zone ID. Zone IDs are 32 hex digits.
  • type (String, Optional) – Domain record type, e.g. ‘A’. Acceptable values: ‘A’, ‘AAAA’, ‘CNAME’, ‘MX’, ‘NS’, ‘SRV’, ‘TXT’.
  • record (String, Optional) – Name of record, e.g. ‘www’. Use the empty string ‘’ to create a record for the domain itself. Must be a valid zone record name. Ensure this value has at most 250 characters.
  • address (String, Optional) – Address of record, eg ‘1.2.3.4’. Only printable ASCII characters are allowed. Ensure this value has at most 250 characters.
  • ttl (Integer, Optional) –

    Time to live - 0 for use this zone’s default TTL. Acceptable values

    0
    Default
    300
    5 minutes
    600
    10 minutes
    900
    15 minutes
    1800
    30 minutes
    3600
    1 hour
    7200
    2 hours
    10800
    3 hours
    21600
    6 hours
    43200
    12 hours
    86400
    24 hours
  • priority (Integer, Optional) – Priority for MX and SRV records, e.g. 10. Ensure this value is greater than or equal to 0. Ensure this value is less than or equal to 999.
  • relative (Boolean, Optional) – If set then we add the current domain onto the address field for CNAME, MX, NS and SRV record types.
Returns:

a dictionary with the zone record in as described in dns.zone_record_info()

dns.zone_update()

Modifies a zone

Any parameters passed in will be used to update the zone.

If you want to create, update or delete zone records and zone domains then use the zone_record and zone_domain methods with the zone_id parameter.

Parameters:
  • id (String) – The Zone ID. Zone IDs are 32 hex digits.
  • nickname (String, Optional) – A customer specified name for the zone file. Not guaranteed unique. Ensure this value has at most 250 characters.
  • ttl (Integer, Optional) –

    Time to live - 0 for use this zone’s default TTL. Acceptable values

    0
    Default
    300
    5 minutes
    600
    10 minutes
    900
    15 minutes
    1800
    30 minutes
    3600
    1 hour
    7200
    2 hours
    10800
    3 hours
    21600
    6 hours
    43200
    12 hours
    86400
    24 hours
Returns:

a dictionary with zone in after modification as returned by dns.zone_info().

Previous topic

Create Methods

Next topic

Firewalling Methods

This Page