Need help? Call Live Support at +31 (0) 38 453 07 59

This page assists you in implementing ADAC to your webshop. There are two ways to integrate ADAC within your webshops. Namely, using our JavaScript client or by connecting directly to the ADAC API. HTTP requests and web sockets can be used in either methods.

Implementing via ADAC's javaScript client
Complexity level: Easy

first, add the ADAC client to the body of your webshop.

<script src="https://adac.api.yoursrs.com/static/client.js"></script>

Then, add the following snippet and fill in the API_KEY and TLD_SET_TOKEN (you can find your API_KEY and a TLD_SET_TOKEN in the ADAC Management Panel).


            <script>
                var API_KEY = '{YOUR_API_KEY}';
                adac.initialize(API_KEY, {
                    TLD_SET_TOKEN: '{A_TLD_SET_TOKEN}',
                    inputElement: document.getElementById('adac-js-domain-input'),
                    resultsElement: document.getElementById('adac-js-domain-results'),
                    suggestionElement: document.getElementById('adac-js-suggestions'),
                    categoriesElement: document.getElementById('adac-js-categories')});
            </script>
        


Installation via the ADAC API
Complexity level: Intermediate

The ADAC API has two entry points, one for a WebSocket connection and one for XMLHttpRequests (AJAX calls). We highly recommend the WebSocket, the AJAX endpoint is only provided to support legacy browsers that do not support WebSockets.

  • WebSockets: wss://adac.api.yoursrs.com/ws All commands and responses are sent as json messages through a WebSockets.
  • XMLHttpRequests: https://adac.api.yoursrs.com/ajax Commands are sent as POST request with json contents, the response does not contain any data. To retrieve responses you open a GET request in a loop to fetch new responses from the API (long-polling), a single response may contain zero, one or multiple response entries.

All request require a session_id url parameter with a UUID4, unique to the session.


Some request & responses:

The ADAC API accepts commands in the following JSON format and also responds in JSON format:


                {
                "api_key": "{YOUR_API_KEY}",
                "action": "{ACTION}",
                "data": "{DATA}"
                }
        

Request To fetch available categories, 'action' should be 'categories' and 'data' can be left empty.


                {
                    "api_key": "{YOUR_API_KEY}",
                    "action": "categories",
                    "data": ""
                }
            
Response

                {
                    "action": "categories",
                    "data":
                        [
                            [1, "First category"],
                            [2, "Second category"]
                        ]
                }
            

Request To do actual checks on domain names, 'action' should be 'input' and 'data' should be a dict containing a 'tld_set_token', 'categories' and the 'input' which is supplied by the user. Possible domain statuses: 0 = waiting, 1 = available, 2 = taken, 3 = invalid, 4 = error, 5 = unknown. This is the main call to execute on user input, domains are checked and suggested based on the configuration in the ADAC admin portal. When a new 'input' action is received all tasks of the previous 'input' action are cancelled.


            {
                "api_key": "{YOUR_API_KEY}",
                "action": "input",
                "data":
                    {
                        tld_set_token: "{A_TLD_SET_TOKEN}",
                        categories: [1, 2],
                        input: "example.com"
                    }
            }
        

Response Note that suffix is the tld


            {
                "action": "domain_status",
                "data":
                    {
                        status: 0,
                        suffix: "com",
                        domain_name: "example.com"
                    }
            }
        

An error response


                {
                    "action": "error",
                    "data": "Invalid domain"
                }
        

Request To check a single domain name, 'action' should be 'check' and 'data' should be a dict containing a 'input' which is the domain to be checked.


            {
                "api_key": "{YOUR_API_KEY}",
                "action": "check",
                "data":
                    {
                        input: "example.com"
                    }
            }
        

Response Note that suffix is the tld


            {
                "action": "domain_status",
                "data":
                    {
                        status: 0,
                        suffix: "com",
                        domain_name: "example.com"
                    }
            }
        

An error response


                {
                    "action": "error",
                    "data": "Invalid domain"
                }