version 3.0.8 (2023.09.07)
version 3.0.7 (2023.08.24)
version 3.0.6 (2023.01.11)
version 3.0.5 (2022.11.24)
version 3.0.4 (2022.05.04)
version 3.0.3 (2022.04.29)
version 3.0.2 (2022.03.20)
version 3.0.1 (2022.02.22)
/*
Signer class for generating timestamp and signature
*/
class Signer {
private $api_username;
private $api_key;
public function __construct($api_username, $api_key) {
$this->api_username = $api_username;
$this->api_key = $api_key;
}
public function timestamp() {
return gmdate("Y-m-d\TH:i:s\Z");
}
public function sign($timestamp, $uri) {
return hash_hmac('sha256', $this->api_username . $timestamp . $uri, $this->api_key);
}
}
//connection parameters
$api_username = 'your_account';
$api_key = 'your_api_key';
$url = 'https://portal.brandit.com/api/v3/';
//generate siganture with Signer
$signer = new Signer($api_username, $api_key);
$timestamp = $signer->timestamp();
$signature = $signer->sign($timestamp, $url);
//define query parameters
$params['user'] = $api_username;
$params['timestamp'] = $timestamp;
$params['signature'] = $signature;
//define command and specific parameters
$params['command'] = 'statusDomain';
$params['domain'] = "yourdomain.ch";
//use test parameter for test requests
$params['test'] = true;
//query the API
$q = curl_init($url);
curl_setopt($q, CURLOPT_RETURNTRANSFER, true);
curl_setopt($q, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($q, CURLOPT_POST, true);
curl_setopt($q, CURLOPT_POSTFIELDS, $params);
$result = curl_exec($q);
curl_close($q);
//get your result
print_R($result);
{
"response": "Domain name not available",
"code": 200,
"status": "success",
"error": ""
}
collapse
{
"response": {
"updatedby": [
"account"
],
"billingcontact": [
"P-CNTCT123"
],
"techcontact": [
"P-CNTCT123"
],
"createdby": [
"account"
],
"zone": [
"ch"
],
"x-domain-roid": [
"D1231234-XXXXX"
],
"transfermode": [
"DEFAULT"
],
"registrationexpirationdate": [
"2023-01-01 22:59:59.0"
],
"updateddate": [
"2022-01-23 09:12:08.0"
],
"paiduntildate": [
"2023-01-01 22:59:59.0"
],
"ownercontact": [
"P-CNTCT123"
],
"renewaldate": [
"2023-01-01 22:59:59.0"
],
"domainidn": [
"domain.ch"
],
"createddate": [
"2015-01-15 14:42:42.0"
],
"roid": [
"12345566123456_DOMAIN-REG"
],
"auth": [
"ghjGU7GHgh"
],
"nameserver": [
"NS1.RRPPROXY.NET",
"NS2.RRPPROXY.NET",
"NS3.RRPPROXY.NET"
],
"transferlock": [
0
],
"registrar": [
"account"
],
"status": [
"ACTIVE"
],
"domain": [
"domain.ch"
],
"renewalmode": [
"DEFAULT"
],
"admincontact": [
"P-CNTCT123"
]
},
"code": 200,
"status": "success",
"error": ""
}
collapse
{
"response": {
"total": 8,
"count": 8,
"first": 0,
"last": 7,
"limit": 100,
"domains": [
{
"domain": "domain1.com",
"domainidn": "domain1.com",
"register_date": "2021-09-01 14:10:16",
"expiration_date": "2022-09-01 14:10:16",
"renewal_date": "2022-10-06 14:10:16",
"renewal_mode": "DEFAULT",
"subaccount": "main_account"
},
{
"domain": "domain2.com",
"domainidn": "domain2.com",
"register_date": "2012-05-03 09:01:36",
"expiration_date": "2022-05-03 09:01:36",
"renewal_date": "2022-06-07 09:01:36",
"renewal_mode": "DEFAULT",
"subaccount": "main_account"
},
{
"domain": "domain3.ch",
"domainidn": "domain3.ch",
"register_date": "2012-01-17 14:42:42",
"expiration_date": "2023-01-31 22:59:59",
"renewal_date": "2023-01-30 22:59:59",
"renewal_mode": "DEFAULT",
"subaccount": "sub_account1"
},
{
"domain": "domain4.com",
"domainidn": "domain4.com",
"register_date": "2012-05-03 08:57:44",
"expiration_date": "2022-05-03 08:57:44",
"renewal_date": "2022-06-07 08:57:44",
"renewal_mode": "DEFAULT",
"subaccount": "sub_account2"
},
{
"domain": "domain5.com",
"domainidn": "domain5.com",
"register_date": "2019-12-09 14:08:03",
"expiration_date": "2022-12-09 14:08:03",
"renewal_date": "2023-01-13 14:08:03",
"renewal_mode": "DEFAULT",
"subaccount": "sub_account2"
},
{
"domain": "domain6.com",
"domainidn": "domain6.com",
"register_date": "2019-12-09 14:07:34",
"expiration_date": "2022-12-09 14:07:34",
"renewal_date": "2023-01-13 14:07:34",
"renewal_mode": "AUTORENEW",
"subaccount": "main_account"
},
{
"domain": "domain7.com",
"domainidn": "domain7",
"register_date": "2022-02-10 14:14:08",
"expiration_date": "2023-02-10 14:14:08",
"renewal_date": "2023-03-17 14:14:08",
"renewal_mode": "AUTOEXPIRE",
"subaccount": "main_account"
},
{
"domain": "domain8.com",
"domainidn": "domain8.com",
"register_date": "2022-02-10 14:14:10",
"expiration_date": "2023-02-10 14:14:10",
"renewal_date": "2023-03-17 14:14:10",
"renewal_mode": "AUTOEXPIRE",
"subaccount": "sub_account3"
}
]
},
"code": 200,
"status": "success",
"error": ""
}
collapse
{
"response": {
"status": "success",
"account": "main_account",
"count": 4,
"domains": [
{
"domain": "test.com",
"register_date": "2019-02-01 00:00:00",
"expiration_date": "2022-02-28 00:00:00",
"renewal_mode": "Default",
"subaccount": "main_account"
},
{
"domain": "domain.com",
"register_date": "2021-09-24 00:00:00",
"expiration_date": "2022-09-24 00:00:00",
"renewal_mode": "Default",
"subaccount": "main_account"
},
{
"domain": "manualdomain.de",
"register_date": "2021-10-18 00:00:00",
"expiration_date": "2022-10-18 00:00:00",
"renewal_mode": "Autoexpire",
"subaccount": "main_account"
},
{
"domain": "domain.ch",
"register_date": "2021-10-19 00:00:00",
"expiration_date": "2022-10-19 00:00:00",
"renewal_mode": "Autoexpire",
"subaccount": "main_account"
}
]
}
}
collapse
{
"response": {
"contactmiddlename": [
""
],
"contactlastname": [
"Smith"
],
"createdby": [
"main_account"
],
"contactorganization": [
"The Company"
],
"contactcountry": [
"CH"
],
"first": [
0
],
"roid": [
"381234550_CONTACT-REG"
],
"count": [
1
],
"contactcity": [
"Z\u00fcrich"
],
"last": [
0
],
"updateddate": [
"2019-10-10 14:24:27"
],
"contactzip": [
8008
],
"contactfax": [
""
],
"contactstate": [
""
],
"contactemail": [
"jsmith@thecompany.ch"
],
"updatedby": [
"main_account"
],
"validated": [
1
],
"contactfirstname": [
"John"
],
"contact": [
"P-CNT3450"
],
"limit": [
100
],
"column": [
"contact",
"roid",
"contact title",
"contact firstname",
"contact middlename",
"contact lastname",
"contact organization",
"contact street",
"contact city",
"contact state",
"contact zip",
"contact country",
"contact phone",
"contact fax",
"contact email",
"created date",
"created by",
"updated date",
"updated by",
"validated",
"verified",
"status",
"deletion date"
],
"deletiondate": [
""
],
"contactstreet": [
"Bellerivestrasse 49"
],
"contacttitle": [
""
],
"verified": [
1
],
"createddate": [
"2016-10-10 14:24:27"
],
"total": [
1
],
"status": [
"linked"
],
"contactphone": [
"0793111555"
]
},
"code": 200,
"status": "success",
"error": ""
}
collapse
{
"response": {
"total": [
2
],
"dnszone": [
"yourdomain.ch",
"yourdomain.ch"
],
"from": [
"a@yourdomain.ch",
"c@yourdomain.ch"
],
"to0": [
"b@yourdomain.ch",
"d@yourdomain2.ch"
],
"last": [
1
],
"count": [
2
],
"to": [
"b@yourdomain.ch",
"d@yourdomain2.ch"
],
"first": [
0
],
"limit": [
1000
],
"column": [
"dnszone",
"from",
"to"
]
},
"code": 200,
"status": "success",
"error": ""
}
collapse
{
"response": {
"limit": [
1000
],
"column": [
"rr"
],
"count": [
6
],
"first": [
0
],
"total": [
6
],
"rr": [
"@ 600 IN MX 10 mx-01.mail-forwarder.io",
"@ 600 IN MX 10 mx-02.mail-forwarder.io",
"@ 28800 IN TXT v=spf1 -all",
"abc 600 IN AAAA 2a00:18e0:5:2:7577:4e4d:413b:f507",
"www 28800 IN A 217.243.200.154",
"subdomain 28800 IN CNAME subdomain.otherdomain.com"
],
"last": [
5
]
},
"code": 200,
"status": "success",
"error": ""
}
collapse
{
"response": {
"zonetype": [
"MASTER"
],
"signed": [
0
]
},
"code": 200,
"status": "success",
"error": ""
}
collapse
{
"response": "Command completed successfully",
"code": 200,
"status": "success",
"error": ""
}
collapse
{
"response": {
"executedate": [
"2023-08-08 11:48:10"
],
"registrar": [
"account"
],
"command": [
"ADDDOMAIN"
],
"objectid": [
"mydomain.ch"
],
"jobid": [
2542690314
],
"objectclass": [
"DOMAIN"
],
"cltrid": [
"CC82667F-582B-4FD4-8F57-56F5AF295732"
],
"statuscode": [
10200
],
"svtrid": [
"3F95B52D-7BB8-49D0-8F36-D2C59E376942"
],
"operationtype": [
"CREATE"
],
"statusdescription": [
"Job Complete - Success - 200 Command completed successfully"
],
"createddate": [
"2023-08-08 11:46:15"
],
"runtime": [
1
],
"roid": [
"20722724313134_DOMAIN-KEYSYS"
]
},
"code": 200,
"status": "success",
"error": ""
}
collapse
{
"response": {
"jobid": [
2283795092
],
"status": [
"REQUESTED"
]
},
"code": 200,
"status": "success",
"error": ""
}
collapse
{
"response": {
"jobid": [
2283795092
],
"status": [
"REQUESTED"
]
},
"code": 200,
"status": "success",
"error": ""
}
collapse
{
"response": {
"total_domains_managed": 10,
"total_domains_external": 2,
"total_domains": 12,
"accounts": {
"2222": {
"id": 2222,
"parent_id": 321,
"name": "your_account",
"alias": "Your Company",
"defaultNS1": "yourns1.com",
"defaultNS2": "yourns2.com",
"defaultNS3": "yourns3.com",
"defaultcontact_admin": "DC12345",
"defaultcontact_owner": "DC12345",
"defaultcontact_tech": "DC12345",
"defaultcontact_billing": "DC12345",
"domains_managed": 6,
"domains_external": 1,
"domains_total": 7
},
"2223": {
"id": 2223,
"parent_id": 2222,
"name": "your_subaccount",
"alias": "Subaccount",
"defaultNS1": "yourns1.com",
"defaultNS2": "yourns2.com",
"defaultNS3": "yourns3.com",
"defaultcontact_admin": "DC12345",
"defaultcontact_owner": "DC12345",
"defaultcontact_tech": "DC12345",
"defaultcontact_billing": "DC12345",
"domains_managed": 4,
"domains_external": 1,
"domains_total": 5
}
}
},
"code": 200,
"status": "success",
"account": "your_account",
"count": 2
}
collapse
{
"response": {
"yourco": {
"351": {
"id": 351,
"username": "john.doe@yourco.ch",
"access": "full access",
"2fa": 1,
"fullname": "John Doe",
"account": "yourco",
"last_login": "2022-10-21 10:30:06",
"created_at": "2022-01-01 00:00:00"
},
"444": {
"id": 444,
"username": "jane.doe@yourco.ch",
"access": "read only access",
"2fa": 1,
"fullname": "Jane Doe",
"account": "yourco",
"last_login": "2022-11-11 16:57:21",
"created_at": "2022-01-11 00:00:00"
}
}
},
"code": 200,
"status": "success",
"account": "yourco",
"count": 2
}
collapse
{
"response": {
"aaa.pro": {
"supports": {
"ipv6": 1,
"dnssec": 1,
"trustee": 0,
"whoisprivacy": 1,
"idn": 1
},
"properties": {
"category": [
"gTLD",
"2nd level"
],
"features": {
"Handle updates": 1,
"Renewal on Transfer": 1,
"Transfer locks possible": 1,
"Preconfigured DNS": 0
},
"localrequirements": [
"Owner contact not required",
"Admin contact not required",
"Tech contact not required",
"Billing contact not required"
],
"responsetimes": {
"WHOIS Update Time:": "real-time"
}
}
},
"abc.br": {
"supports": {
"ipv6": 1,
"dnssec": 1,
"trustee": 1,
"whoisprivacy": 0,
"idn": 1
},
"properties": {
"category": [
"ccTLD",
"2nd level"
],
"features": {
"Handle updates": 0,
"Renewal on Transfer": 0,
"Transfer locks possible": 0,
"Preconfigured DNS": 1
},
"localrequirements": [
"Owner contact not required",
"Admin contact not required",
"Tech contact not required",
"Billing contact not required"
],
"responsetimes": {
"Registration Time:": "up to 3 working days"
}
}
}
},
"code": 200,
"status": "success",
"error": "",
"count": 1242
}
collapse
{
"response": {
"Zone": "ch",
"zone info": ".CH is the official country code Top-Level-Domain (ccTLD) of Switzerland.",
"registration time working days": 0,
"registration periods": "1y",
"renewal periods": "n\/a",
"minimum length": 3,
"maximum length": 63,
"ipv6": 1,
"dnssec": 1,
"trustee": 0,
"idn": 1,
"whoisprivacy": 0,
"transfer locks possible": 0,
"renewal on transfer": 0,
"transfer time days": "",
"authcode minimum": 6,
"authcode maximum": 16,
"handles updateable": 1,
"preconfigured DNS": 0,
"nameservers minimum": 1,
"nameservers maximum": 13,
"autorenew grace period days": 0,
"deletion timeframe days": -1,
"redemption period days": 0,
"web WHOIS": "whois.nic.ch",
"registry": "http:\/\/www.switch.ch\/",
"terms and conditions": "https:\/\/www.nic.ch\/reg\/cm\/wcm-resource\/download\/terms\/SWITCH_AGB_en.pdf",
"dispute policy": "http:\/\/www.switch.ch\/id\/terms\/"
},
"code": 200,
"status": "success",
"error": "",
"count": 28
}
collapse