/srs/create_contact
POST https://api.sitehost.nz/1.0/srs/create_contact.json
Creates a domain contact.
Form Parameters
Parameter | Type | Required | Description |
client_id | integer | Yes | The ID for the client that the contact belongs to.Example: 1 |
name | string | Yes | The contact name.Example: Example |
string | Yes | The email address.Example: example@example.com | |
postal_address | string | Yes | The postal address.Example: 1 Example Rd |
suburb | string | The suburb.Example: Ellerslie | |
city | string | Yes | The city.Example: Auckland |
country | string | Yes | The country code.Example: NZ |
params[PostCode] | string | Yes | The postcode.Example: 612 |
params[Province] | string | The province.Example: Ellerslie | |
params[Phone][Country] | string | Yes | The country code for the phone number.Example: 64 |
params[Phone][Area] | string | Yes | The area code for the phone number.Example: 9 |
params[Phone][Local] | string | Yes | The local part of the phone number.Example: 123456 |
params[Fax][Country] | string | The country code for the fax number.Example: 64 | |
params[Fax][Area] | string | The area code for the fax number.Example: 9 | |
params[Fax][Local] | string | The local part of the fax number.Example: 123456 | |
params[Mobile][Country] | string | The country code for the mobile number.Example: 64 | |
params[Mobile][Area] | string | The area code for the mobile number.Example: 21 | |
params[Mobile][Local] | string | The local part of the mobile number.Example: 123456 |
Code Samples
JavaScript PHP Rails Pythonvar 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
}
"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
}