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.
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>
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.
All request require a session_id url parameter with a UUID4, unique to the session.
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"
}