/srs/create_contact


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

Creates a domain contact.

Form Parameters

ParameterTypeRequiredDescription
client_idintegerYesThe ID for the client that the contact belongs to.Example: 1
namestringYesThe contact name.Example: Example
emailstringYesThe email address.Example: example@example.com
postal_addressstringYesThe postal address.Example: 1 Example Rd
suburbstringThe suburb.Example: Ellerslie
citystringYesThe city.Example: Auckland
countrystringYesThe country code.Example: NZ
params[PostCode]stringYesThe postcode.Example: 612
params[Province]stringThe province.Example: Ellerslie
params[Phone][Country]stringYesThe country code for the phone number.Example: 64
params[Phone][Area]stringYesThe area code for the phone number.Example: 9
params[Phone][Local]stringYesThe local part of the phone number.Example: 123456
params[Fax][Country]stringThe country code for the fax number.Example: 64
params[Fax][Area]stringThe area code for the fax number.Example: 9
params[Fax][Local]stringThe local part of the fax number.Example: 123456
params[Mobile][Country]stringThe country code for the mobile number.Example: 64
params[Mobile][Area]stringThe area code for the mobile number.Example: 21
params[Mobile][Local]stringThe local part of the mobile number.Example: 123456

Code Samples

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

var data = new FormData();
data.append("apikey", "your_key_here");
data.append("client_id", "1");
data.append("name", "Example");
data.append("email", "example@example.com");
data.append("postal_address", "1 Example Rd");
data.append("suburb", "Ellerslie");
data.append("city", "Auckland");
data.append("country", "NZ");
data.append("params[PostCode]", "612");
data.append("params[Province]", "Ellerslie");
data.append("params[Phone][Country]", "64");
data.append("params[Phone][Area]", "9");
data.append("params[Phone][Local]", "123456");
data.append("params[Fax][Country]", "64");
data.append("params[Fax][Area]", "9");
data.append("params[Fax][Local]", "123456");
data.append("params[Mobile][Country]", "64");
data.append("params[Mobile][Area]", "21");
data.append("params[Mobile][Local]", "123456");

xmlHttp.send(data);

var response = xmlHttp.responseText;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sitehost.nz/1.0/srs/create_contact.json");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$body = array(
'apikey' => 'your_key_here',
'client_id' => 1,
'name' => 'Example',
'email' => 'example@example.com',
'postal_address' => '1 Example Rd',
'suburb' => 'Ellerslie',
'city' => 'Auckland',
'country' => 'NZ',
'params[PostCode]' => '612',
'params[Province]' => 'Ellerslie',
'params[Phone][Country]' => '64',
'params[Phone][Area]' => '9',
'params[Phone][Local]' => '123456',
'params[Fax][Country]' => '64',
'params[Fax][Area]' => '9',
'params[Fax][Local]' => '123456',
'params[Mobile][Country]' => '64',
'params[Mobile][Area]' => '21',
'params[Mobile][Local]' => '123456',
);
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_contact.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,
"name" => "Example",
"email" => "example@example.com",
"postal_address" => "1 Example Rd",
"suburb" => "Ellerslie",
"city" => "Auckland",
"country" => "NZ",
"params[PostCode]" => "612",
"params[Province]" => "Ellerslie",
"params[Phone][Country]" => "64",
"params[Phone][Area]" => "9",
"params[Phone][Local]" => "123456",
"params[Fax][Country]" => "64",
"params[Fax][Area]" => "9",
"params[Fax][Local]" => "123456",
"params[Mobile][Country]" => "64",
"params[Mobile][Area]" => "21",
"params[Mobile][Local]" => "123456",
}
request.set_form_data(body)

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

uri = 'https://api.sitehost.nz/1.0/srs/create_contact.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['name'] = 'Example'
body['email'] = 'example@example.com'
body['postal_address'] = '1 Example Rd'
body['suburb'] = 'Ellerslie'
body['city'] = 'Auckland'
body['country'] = 'NZ'
body['params[PostCode]'] = '612'
body['params[Province]'] = 'Ellerslie'
body['params[Phone][Country]'] = '64'
body['params[Phone][Area]'] = '9'
body['params[Phone][Local]'] = '123456'
body['params[Fax][Country]'] = '64'
body['params[Fax][Area]'] = '9'
body['params[Fax][Local]'] = '123456'
body['params[Mobile][Country]'] = '64'
body['params[Mobile][Area]'] = '21'
body['params[Mobile][Local]'] = '123456'

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

Response

200:

application/json
{
  "return": {
    "ClientID": "1",
    "Name": "Example",
    "RegistrantName": "Example",
    "Email": "example@example.com",
    "PostalAddress": "1 Example Rd",
    "Suburb": "",
    "City": "Auckland",
    "Country": "NZ",
    "PostCode": "0612",
    "Province": "",
    "PhoneCountry": "0064",
    "PhoneArea": "09",
    "PhoneLocal": "123456",
    "Phone": "0064-09-123456",
    "Fax": "--",
    "Mobile": "--",
    "DomainCount": "0",
    "RegistrantCount": "0",
    "ContactID": "382"
  },
  "msg": "Successful.",
  "status": true,
  "time": 70.11
}