/srs/create_domain


POST https://api.sitehost.nz/1.0/srs/create_domain.json

Creates a domain.

Form Parameters

ParameterTypeRequiredDescription
client_idintegerYesThe ID for the client that the domain belongs to.Example: 1
domainstringYesThe domain name to be created.Example: example.com
termintegerYesThe domain registration term in months.Example: 12
registrant_contactintegerYesThe ID of a domain contact to be used as the registrant contact.Example: 12
params[RegisterExpired]integerThe option to register this domain when it becomes available. 1 for yes and 0 for noExample: 0
params[AdminContact]integerThe ID of a domain contact to be used as the administrative contact.Example: 12
params[TechContact]integerThe ID of a domain contact to be used as the technical contact.Example: 12
params[protect]stringThe option for Privacy Protection. 1 for yes and 0 for noExample: 0
params[auid_type]stringThe option for Australian Business Number Type.
params[auid_value]stringThe option for Australian Business Number.
params[auid_reason]stringThe option for Australian Domain Reason.
params[auid_cname]stringThe option for Australian Company Name.
params[auid_ctype]stringThe option for Australian Company Type.

Code Samples

JavaScript PHP Rails Python
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("POST", "https://api.sitehost.nz/1.0/srs/create_domain.json", false);

var data = new FormData();
data.append("apikey", "your_key_here");
data.append("client_id", "1");
data.append("domain", "example.com");
data.append("term", "12");
data.append("registrant_contact", "12");
data.append("params[RegisterExpired]", "0");
data.append("params[AdminContact]", "12");
data.append("params[TechContact]", "12");
data.append("params[protect]", "0");
data.append("params[auid_type]", "");
data.append("params[auid_value]", "");
data.append("params[auid_reason]", "");
data.append("params[auid_cname]", "");
data.append("params[auid_ctype]", "");

xmlHttp.send(data);

var response = xmlHttp.responseText;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sitehost.nz/1.0/srs/create_domain.json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$body = array(
'apikey' => 'your_key_here',
'client_id' => 1,
'domain' => 'example.com',
'term' => 12,
'registrant_contact' => 12,
'params[RegisterExpired]' => 0,
'params[AdminContact]' => 12,
'params[TechContact]' => 12,
'params[protect]' => '0',
'params[auid_type]' => '',
'params[auid_value]' => '',
'params[auid_reason]' => '',
'params[auid_cname]' => '',
'params[auid_ctype]' => '',
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);

$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
require 'net/http'
require 'uri'

uri = URI.parse("https://api.sitehost.nz/1.0/srs/create_domain.json")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)

body = {"apikey" => "your_key_here",
"client_id" => 1,
"domain" => "example.com",
"term" => 12,
"registrant_contact" => 12,
"params[RegisterExpired]" => 0,
"params[AdminContact]" => 12,
"params[TechContact]" => 12,
"params[protect]" => "0",
"params[auid_type]" => "",
"params[auid_value]" => "",
"params[auid_reason]" => "",
"params[auid_cname]" => "",
"params[auid_ctype]" => "",
}
request.set_form_data(body)

response = http.request(request)
import requests
from collections import OrderedDict

uri = 'https://api.sitehost.nz/1.0/srs/create_domain.json'

# We need ordered dictionary because parameters have to be in the right order.
# Refer to Developer Notes for more information.
body = OrderedDict()

body['apikey'] = 'your_key_here'
body['client_id'] = 1
body['domain'] = 'example.com'
body['term'] = 12
body['registrant_contact'] = 12
body['params[RegisterExpired]'] = 0
body['params[AdminContact]'] = 12
body['params[TechContact]'] = 12
body['params[protect]'] = '0'
body['params[auid_type]'] = ''
body['params[auid_value]'] = ''
body['params[auid_reason]'] = ''
body['params[auid_cname]'] = ''
body['params[auid_ctype]'] = ''

response = requests.post(uri, data=body)

Response

200:

application/json
{
  "return": {
    "job_id": "3433562"
  },
  "msg": "Successful",
  "status": true,
  "time": 29.92
}