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

set_domain_forwarding

Configures the domain forwarding settings for a domain.

Note:

Domain forwarding must already have been created for the domain.
See create_domain_forwarding.

The way in which the domain forwarding behaves depends on the format of
the domain name to which it applies:

  • domain.com—Applies to all requests for this domain, unless overridden by a second domain forwarding record. For example, if a site visitor looks for whatever.domain.com, domain forwarding is applied (unless a specific record has been set up for whatever.domain.com, or *.domain.com). In other words, if no other forwarding is set up, domain.com acts as a catch-all.
  • *.domain.com—Applies domain forwarding to all subdomains. It will not handle domain.com, but it will handle anything.domain.com.
  • whatever.domain.com—Domain forwarding is applied to this subdomain only.

Request parameters for set_domain_forwarding

Standard parameters

  • action = update_domain_forwarding
  • object = domain

Attributes

Parameters within the attributes associative array are described below.

Parameter name
Obligation
Definition/Value

domain

Required

The relevant domain.

forwarding

Optional

A list of the subdomains that you want forwarded and their associated attributes.

For more information, see the Forwarding table below.

Forwarding

Parameters within the forwarding associative array are described below.

Parameter name
Obligation
Definition/Value

description

Optional

A short description of your website. The maximum number of characters allowed is 255.

Note: This parameter only takes effect if masked = 1.

destination_url

Optional

The full address of the destination website, for example, http://www.mycompany.com/ mybestpage.html, or the IP address, for example, http://12.34.56.123
The maximum number of characters allowed is 200.

enabled

Optional

Determines whether domain forwarding is in effect.

  • 0—Turn off domain forwarding

  • 1—Turn on domain forwarding

keywords

Optional

Descriptive words that a visitor might use when searching for your website. Separate each word or phrase with a comma.

The maximum number of characters allowed is 900.

Note: This parameter only takes effect if masked =
1
.

masked

Optional

Determines the destination website address appears
in the browser address field.

  • 0—Display the actual destination address.

  • 1—Mask the destination address and display the original domain address instead.

subdomain

Required

The third level of the domain name, such as www or ftp. For example, if you specify www, visitors who type example.com are redirected to www.example.com.

The maximum number of characters allowed is 128.

Note: Although this parameter is required, its value can be null.

title

Optional

The text that you want to appear in the browser title bar.

The maximum number of characters allowed is 255.

Note: This parameter only takes effect if masked = 1.

Response parameters for set_domain_forwarding

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

Examples for set_domain_forwarding

Example 1

Request

<?xml version='1.0' encoding='UTF-8'?>
<OPS_envelope>
    <header>
        <version>0.9</version>
    </header>
    <body>
        <data_block>
            <dt_assoc>
                <item key="protocol">XCP</item>
                <item key="action">set_domain_forwarding</item>
                <item key="object">domain</item>
                <item key="attributes">
                    <dt_assoc>
                        <item key="domain">example.com</item>
                        <item key="forwarding">
                            <dt_array>
                                <item key="0">
                                    <dt_assoc>
                                        <item key="masked">1</item>
                                        <item key="keywords">Example2.com</item>
                                        <item key="destination_url">http://www.example2.com</item>
                                        <item key="enabled">1</item>
                                        <item key="description">Example2.com</item>
                                        <item key="subdomain">mail</item>
                                        <item key="title">Example2.com</item>
                                    </dt_assoc>
                                </item>
                            </dt_array>
                        </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="response_text">Command Successful</item>
                <item key="response_code">200</item>
                <item key="is_success">1</item>
            </dt_assoc>
        </data_block>
    </body>
</OPS_envelope>

Example 2

Without end-user credentials

Request

<?xml version='1.0' encoding='UTF-8'?>
<OPS_envelope>
    <header>
        <version>0.9</version>
    </header>
    <body>
        <data_block>
            <dt_assoc>
                <item key="protocol">XCP</item>
                <item key="action">set_domain_forwarding</item>
                <item key="object">domain</item>
                <item key="attributes">
                    <dt_assoc>
                        <item key="domain">mydomain.com</item>
                        <item key="forwarding">
                            <dt_array>
                                <item key="0">
                                    <dt_assoc>
                                        <item key="keywords">shopping cart
                                            checkout</item>
                                        <item key="masked">1</item>
                                        <item key="subdomain">cart</item>
                                        <item key="destination_url">http://payment.gateway.biz</item>
                                        <item key="title">Shopping Cart Checkout
                                            Gateway</item>
                                        <item key="description">Access to user shopping cart for checkout handling.</item>
                                        <item key="enabled">1</item>
                                    </dt_assoc>
                                </item>
                            </dt_array>
                        </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="response_text">Command Successful</item>
                <item key="response_code">200</item>
                <item key="is_success">1</item>
            </dt_assoc>
        </data_block>
    </body>
</OPS_envelope>

set_domain_forwarding

Configures the domain forwarding settings for a domain.