/srs/create_contact
POST https://api.sitehost.nz/1.2/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 |
postal_address2 | string | Yes | The postal address 2.Example: Round the bend |
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[Organization] | string | The organization.Example: Example Corp. | |
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[Phone][Extension] | string | The extension part of the phone number.Example: 789 | |
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[Fax][Extension] | string | The extension part of the fax number.Example: 789 | |
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 | |
params[Mobile][Extension] | string | The extension part of the mobile number.Example: 789 |
Code Samples
JavaScript PHP Rails Pythonvar xmlHttp = new XMLHttpRequest();
xmlHttp.open("POST", "https://api.sitehost.nz/1.2/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("postal_address2", "Round the bend");
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[Organization]", "Example Corp.");
data.append("params[Phone][Country]", "64");
data.append("params[Phone][Area]", "9");
data.append("params[Phone][Local]", "123456");
data.append("params[Phone][Extension]", "789");
data.append("params[Fax][Country]", "64");
data.append("params[Fax][Area]", "9");
data.append("params[Fax][Local]", "123456");
data.append("params[Fax][Extension]", "789");
data.append("params[Mobile][Country]", "64");
data.append("params[Mobile][Area]", "21");
data.append("params[Mobile][Local]", "123456");
data.append("params[Mobile][Extension]", "789");
xmlHttp.send(data);
var response = xmlHttp.responseText;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sitehost.nz/1.2/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',
'postal_address2' => 'Round the bend',
'suburb' => 'Ellerslie',
'city' => 'Auckland',
'country' => 'NZ',
'params[PostCode]' => '612',
'params[Province]' => 'Ellerslie',
'params[Organization]' => 'Example Corp.',
'params[Phone][Country]' => '64',
'params[Phone][Area]' => '9',
'params[Phone][Local]' => '123456',
'params[Phone][Extension]' => '789',
'params[Fax][Country]' => '64',
'params[Fax][Area]' => '9',
'params[Fax][Local]' => '123456',
'params[Fax][Extension]' => '789',
'params[Mobile][Country]' => '64',
'params[Mobile][Area]' => '21',
'params[Mobile][Local]' => '123456',
'params[Mobile][Extension]' => '789',
);
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.2/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",
"postal_address2" => "Round the bend",
"suburb" => "Ellerslie",
"city" => "Auckland",
"country" => "NZ",
"params[PostCode]" => "612",
"params[Province]" => "Ellerslie",
"params[Organization]" => "Example Corp.",
"params[Phone][Country]" => "64",
"params[Phone][Area]" => "9",
"params[Phone][Local]" => "123456",
"params[Phone][Extension]" => "789",
"params[Fax][Country]" => "64",
"params[Fax][Area]" => "9",
"params[Fax][Local]" => "123456",
"params[Fax][Extension]" => "789",
"params[Mobile][Country]" => "64",
"params[Mobile][Area]" => "21",
"params[Mobile][Local]" => "123456",
"params[Mobile][Extension]" => "789",
}
request.set_form_data(body)
response = http.request(request)
import requests
from collections import OrderedDict
uri = 'https://api.sitehost.nz/1.2/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['postal_address2'] = 'Round the bend'
body['suburb'] = 'Ellerslie'
body['city'] = 'Auckland'
body['country'] = 'NZ'
body['params[PostCode]'] = '612'
body['params[Province]'] = 'Ellerslie'
body['params[Organization]'] = 'Example Corp.'
body['params[Phone][Country]'] = '64'
body['params[Phone][Area]'] = '9'
body['params[Phone][Local]'] = '123456'
body['params[Phone][Extension]'] = '789'
body['params[Fax][Country]'] = '64'
body['params[Fax][Area]'] = '9'
body['params[Fax][Local]'] = '123456'
body['params[Fax][Extension]'] = '789'
body['params[Mobile][Country]'] = '64'
body['params[Mobile][Area]'] = '21'
body['params[Mobile][Local]'] = '123456'
body['params[Mobile][Extension]'] = '789'
response = requests.post(uri, data=body)
Response
200:application/json
{
"return": {
"ClientID": "1",
"Name": "Example",
"RegistrantName": "Example",
"Organization": "Example Corp.",
"Email": "example@example.com",
"PostalAddress": "1 Example Rd",
"PostalAddress2": "Round the bend",
"Suburb": "",
"City": "Auckland",
"Country": "NZ",
"PostCode": "0612",
"Province": "",
"PhoneCountry": "0064",
"PhoneArea": "09",
"PhoneLocal": "123456",
"PhoneExtension": "789",
"FaxCountry": "0064",
"FaxArea": "09",
"FaxLocal": "123456",
"FaxExtension": "789",
"MobileCountry": "0064",
"MobileArea": "09",
"MobileLocal": "123456",
"MobileExtension": "789",
"Phone": "0064-09-123456",
"Fax": "--",
"Mobile": "--",
"DomainCount": "0",
"RegistrantCount": "0",
"ContactID": "382"
},
"msg": "Successful.",
"status": true
}
"return": {
"ClientID": "1",
"Name": "Example",
"RegistrantName": "Example",
"Organization": "Example Corp.",
"Email": "example@example.com",
"PostalAddress": "1 Example Rd",
"PostalAddress2": "Round the bend",
"Suburb": "",
"City": "Auckland",
"Country": "NZ",
"PostCode": "0612",
"Province": "",
"PhoneCountry": "0064",
"PhoneArea": "09",
"PhoneLocal": "123456",
"PhoneExtension": "789",
"FaxCountry": "0064",
"FaxArea": "09",
"FaxLocal": "123456",
"FaxExtension": "789",
"MobileCountry": "0064",
"MobileArea": "09",
"MobileLocal": "123456",
"MobileExtension": "789",
"Phone": "0064-09-123456",
"Fax": "--",
"Mobile": "--",
"DomainCount": "0",
"RegistrantCount": "0",
"ContactID": "382"
},
"msg": "Successful.",
"status": true
}