API: OpenSRS

OpenSRS API Guide: Domains and SSL

Welcome to the OpenSRS API guide. Here you will find comprehensive documentation regarding our domain and SSL services. We hope this guide will help you start working with OpenSRS as quickly as possible. If you have any questions or concerns, please do not hesitate to contact help@opensrs.com

Get Started

create_dns_zone

Enables the DNS service for a domain. If you have created a DNS template, you can specify the template in the command to assign initial DNS records. The template is then associated with the domain, so if you later issue the reset_dns_zone command, the records are set back to what is defined in the template.

If you specify blank instead of a DNS template when you issue this command, you can submit the values for the DNS records in this command or you can use the set_dns_zone command to define the DNS records.

For information on creating a DNS zone template, see “Managing DNS Zone Information” in the Reseller’s Guide to Domain Name Registration and Management.

Request parameters for create_dns_zone

Standard parameters

  • action = create_dns_zone
  • object = domain attributes

Attributes

Parameters within the attributes associative array are described below.

Parameter name
Obligation
Obligation

domain

Required

The domain for which you want to define DNS records.

dns_template

Optional

Specify the name of the DNS template that you want to use to enable DNS and assign initial DNS records.

If you do not submit this parameter, DNS is enabled but no records are defined. In this case, you can submit the settings for the domain's DNS zone records (A, AAAA, CNAME, SRV, and TXT).

records

Required

A list of the record types defined for the domain; each record includes the settings for that record.
Record types may be

  • A
  • AAAA
  • CNAME
  • MX
  • SRV
  • TXT

Records

Parameters within the records associative array are described below.

Parameter name
Obligation
Definition/Value

A

Optional

Maps the domain name to the IP address.

The A record consists of the following:

  • ip_address—Internet Protocol Address. A numeric address that computers recognize, for example,
    123.45.54.123.

  • subdomain—The third level of the domain name, such as www or ftp.

AAAA

Optional

Maps the domain name to the IPv6 address.

The AAAA record consists of the following:

  • ipv6_address— The next generation Internet Protocol designed as the successor to version 4. It is normally written as eight groups of four hexadecimal digits (i.e. 2003:0db8:
    85a3:0000:0000:8a2e:
    0370:7334

  • subdomain—The third level of the domain name, such as www or ftp.

CNAME

Optional

Canonical Name. CNAME records can be used when you want a subdomain to point to another hostname. Allows you to create an alias for your domain.

The CNAME record consists of the following:

  • hostname—The FQDN of the domain that you want to access.

  • subdomain—The third level of the domain name, such as www or ftp.

MX

Optional

Mail Exchange. MX records determine how mail is delivered to your domain. Ensures that email that is sent to you is routed to the correct destination.

The MX record consists of the following:

  • priority—The priority of the target host,lower
    value means more preferred.

  • subdomain—The third level of the domain
    name, such as www or ftp.

  • hostname—The FQDN of the domain that you
    want to access.

SRV

Optional

Service Record.
The SRV record consists of the following:

  • priority—The priority of the target host,lower
    value means more preferred.

  • weight—A relative weight for records with the
    same priority.

  • subdomain—The third level of the domain
    name, such as www or ftp.

  • hostname—The FQDN of the domain that you
    want to access.

  • port—The TCP or UDP port on which the service is to be found.

Response parameters for create_dns_zone

Standard parameters

  • action = reply
  • object = domain
  • is_success = a Boolean is returned, indicating success or failure of the
    request
  • response_code = response code indicating outcome of the request
  • response_text = message describing the outcome of the request

Attributes

If the request is successful, the attributes associative array may include the
following:

Parameter name
Obligation
Definition/Value

nameservers_ok

Returned if is_success = true

Indicates whether the domain is set up to use the OpenSRS nameservers.

  • 0—Nameservers are not set to the DNS service nameservers

  • 1—Nameservers are set to the DNS service nameservers

records

Returned if is_success = true

A list of the record types defined for the domain; each record includes the settings for that record.

Record types may be

  • A
  • AAAA
  • CNAME
  • MX
  • SRV
  • TXT

For more information, see the Records table below.

Records

Parameters within the records associative array are described below.

Parameter name
Obligation
Definition/Value

A

Optional

Maps the domain name to the IP address. The A record consists of the following:

  • ip_address—InternetProtocolAddress.A numeric address that computers recognize, for example, 123.45.54.123.

  • subdomain—The third level of the domain name, such as www or ftp.

AAAA

Optional

Maps the domain name to the IPv6 address. The AAAA record consists of the following:

  • subdomain—The third level of the domain name, such as www or ftp.

  • ipv6_address— The next generation Internet Protocol designed as the successor to version 4. It is normally written as eight groups of four hexadecimal digits (i.e. 2003:0db8:
    85a3:0000:0000:8a2e:
    0370:7334

CNAME

Optional

Canonical Name. CNAME records can be used when you want a subdomain to point to another hostname. Allows you to create an alias for your domain.

The CNAME record consists of the following:

  • hostname—The FQDN of the domain that you want to access.

  • subdomain—The third level of the domain name, such as www or ftp.

MX

Optional

Mail Exchange. MX records determine how mail is delivered to your domain. Ensures that email that is sent to you is routed to the correct destination.

The MX record consists of the following:

  • priority—The priority of the target host,lower value means more preferred.

  • subdomain—The third level of the domain name, such as www or ftp.

  • hostname—The FQDN of the domain that you want to access.

SRV

Optional

Service Record.

The SRV record consists of the following:

  • priority—The priority of the target host,lower
    value means more preferred.

  • weight—Arelative weight for records with the
    same priority.

  • subdomain—The third level of the domain name, such as www or ftp. hostname—The FQDN of the domain that you want to access. port—The TCP or UDP port on which the service is to be found.

TXT

Optional

Text Record. Allows you to attach comments to a hostname, for example, SPF data to validate that email is being sent from the IP address of the domain's mail server.

The TXT record consists of the following:

  • subdomain—The third level of the domain
    name, such as www or ftp.

  • text—The comments that you want to include.

Examples for create_dns_zone

Request

<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!DOCTYPE OPS_envelope SYSTEM 'ops.dtd'>
<OPS_envelope>
    <header>
        <version>0.9</version>
    </header>
    <body>
        <data_block>
            <dt_assoc>
                <item key="protocol">XCP</item>
                <item key="action">create_dns_zone</item>
                <item key="object">domain</item>
                <item key="attributes">
                    <dt_assoc>
                        <item key="domain">example.com</item>
                        <item key="dns_template">business_domains</item>
                    </dt_assoc>
                </item>
            </dt_assoc>
        </data_block>
    </body>
</OPS_envelope>
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!DOCTYPE OPS_envelope SYSTEM 'ops.dtd'>
<OPS_envelope>
    <header>
        <version>0.9</version>
    </header>
    <body>
        <data_block>
            <dt_assoc>
                <item key="protocol">XCP</item>
                <item key="action">create_dns_zone</item>
                <item key="object">domain</item>
                <item key="attributes">
                    <dt_assoc>
                        <item key="domain">example.com</item>
                    </dt_assoc>
                </item>
            </dt_assoc>
        </data_block>
    </body>
</OPS_envelope>

Response

<?xml version='1.0' encoding="UTF-8" standalone="no"?>
<!DOCTYPE OPS_envelope SYSTEM "ops.dtd">
<OPS_envelope>
    <header>
        <version>0.9</version>
    </header>
    <body>
        <data_block>
            <dt_assoc>
                <item key="protocol">XCP</item>
                <item key="action">REPLY</item>
                <item key="object">DOMAIN</item>
                <item key="is_success">1</item>
                <item key="response_text">Command Successful</item>
                <item key="response_code">200</item>
                <item key="attributes">
                    <dt_assoc>
                        <item key="records">
                            <dt_assoc>
                                <item key="A">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="subdomain"></item>
                                                <item key="ip_address">17.16.156.5</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                                <item key="MX">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="priority">10</item>
                                                <item key="subdomain">www</item>
                                                <item key="hostname">example.org</item>
                                            </dt_assoc>
                                        </item>
                                        <item key="1">
                                            <dt_assoc>
                                                <item key="priority">1</item>
                                                <item key="subdomain"></item>
                                                <item key="hostname">mx.cust.aug18dnstest1.com.hostedemail.com</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                                <item key="SRV">
                                    <dt_array>
                                        <item key="0">
                                            <dt_assoc>
                                                <item key="priority">1</item>
                                                <item key="weight">3</item>
                                                <item key="subdomain">w3</item>
                                                <item key="hostname">yummynames.com</item>
                                                <item key="port">81</item>
                                            </dt_assoc>
                                        </item>
                                    </dt_array>
                                </item>
                            </dt_assoc>
                        </item>
                        <item key="nameservers_ok">0</item>
                    </dt_assoc>
                </item>
            </dt_assoc>
        </data_block>
    </body>
</OPS_envelope>
<?xml version='1.0' encoding="UTF-8" standalone="no"?>
<!DOCTYPE OPS_envelope SYSTEM "ops.dtd">
<OPS_envelope>
    <header>
        <version>0.9</version>
    </header>
    <body>
        <data_block>
            <dt_assoc>
                <item key="protocol">XCP</item>
                <item key="action">REPLY</item>
                <item key="object">DOMAIN</item>
                <item key="is_success">1</item>
                <item key="response_text">Command Successful</item>
                <item key="response_code">200</item>
                <item key="attributes">
                    <dt_assoc>
                        <item key="records">
                            <dt_assoc></dt_assoc>
                        </item>
                        <item key="nameservers_ok">0</item>
                    </dt_assoc>
                </item>
            </dt_assoc>
        </data_block>
    </body>
</OPS_envelope>

create_dns_zone

Enables the DNS service for a domain. If you have created a DNS template, you can specify the template in the command to assign initial DNS records. The template is then associated with the domain, so if you later issue the reset_dns_zone command, the records are set back to what is defined in the template.

If you specify blank instead of a DNS template when you issue this command, you can submit the values for the DNS records in this command or you can use the set_dns_zone command to define the DNS records.

For information on creating a DNS zone template, see “Managing DNS Zone Information” in the Reseller’s Guide to Domain Name Registration and Management.