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

generate_redirection_code

Generate code that redirects visitors to either the source domain or the mobile domain, depending on the device they’re using.

Request parameters for generate_redirection_code

Standard parameters

  • action = generate_redirection_code
  • object = publishing

Attributes

Parameters within the attributes associative array are described below.

Parameter name
Obligation
Definition/Value

domain

Required

The name of the mobile domain that you want to let expire.

programming_language

Required

The programming language for the code. Allowed values are:

  • asp
  • htaccess
  • javascript
  • jsp
  • php

service_type

Required

The type of Publishing service.

Allowed value is gomobi.

Response parameters for generate_redirection_code

Standard parameters

  • action = reply
  • object = publishing
  • 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

redirection_code

Returned if is_success = true

The code that you insert in your source website that redirects visitors to the source or the mobile site depending on the device they're using to access it.

Examples for generate_redirection_code

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">GENERATE_REDIRECTION_CODE</item>
                <item key="object">PUBLISHING</item>
                <item key="attributes">
                    <dt_assoc>
                        <item key="programming_language">javascript</item>
                        <item key="service_type">gomobi</item>
                        <item key="domain">example.net</item>
                    </dt_assoc>
                </item>
            </dt_assoc>
        </data_block>
    </body>
</OPS_envelope>
<?xml version='1.0' encoding="UTF-8" standalone="no"?>
<OPS_envelope>
    <header>
        <version>0.9</version>
    </header>
    <body>
        <data_block>
            <dt_assoc>
                <item key="protocol">XCP</item>
                <item key="object">PUBLISHING</item>
                <item key="response_text">Got GoMobi redirection code (javascript) for 'example.net'</item>
                <item key="action">GENERATE_REDIRECTION_CODE:REPLY</item>
                <item key="attributes">
                    <dt_assoc>
                        <item key="redirection_code">&lt;script type="text/javascript" src="http://detect.deviceatlas.com/redirect.js?d=http://example.net&amp;m=http://example.net"&gt;&lt;/script&gt;</item>
                    </dt_assoc>
                </item>
                <item key="response_code">200</item>
                <item key="is_success">1</item>
            </dt_assoc>
        </data_block>
    </body>
</OPS_envelope>

generate_redirection_code

Generate code that redirects visitors to either the source domain or the mobile domain, depending on the device they’re using.