域名相关 - API文档

域名注册

/Domain/Register

API分类 域名相关 请求方法 POST

API简介

实时域名注册接口,要求用户名下有足够的款项。

请求参数

名称 必须 说明
ApiKey API请求时必须提供的密钥,请和管理员联系索取
Password 登录朝暮数据用户管理的密码
Domain 相关域名,如abc.com
Years 注册或续费年数,可选1-10年,整数格式
OrganizeNameCN 注册单位中文
OrganizeNameUK 注册单位英文
UserNameCN 注册人中文
UserNameUK 注册人英文
StreetCN 联系地址中文
StreetUK 联系地址英文
CityCN 城市中文
CityUK 城市英文
ProvinceUK 省份拼音,如Shanghai
ZipCode 邮编,如200434
PhoneArea 电话区号,如021
PhoneNumber 电话号码,如51873999
FaxArea 传真区号,如021
FaxNumber 传真号码,如51873999
Email 电子邮件

注:参数名称不区分大小写。

请求示例

BASE_URL/Domain/Register

以下参数请用 POST 方式提交到 Form Data 中。

  • ApiKey=testApi
  • Password=testPassword
  • Domain=zhaomu123.com
  • Years=1
  • OrganizeNameCN=上海寻义信息科技有限公司
  • OrganizeNameUK=Shanghai Xunyi Company
  • UserNameCN=张三
  • UserNameCN=Zhang San
  • StreetCN=虹口区广粤路289号
  • StreetUK=GuangYue Road 289,HongKou District
  • CityCN=上海市
  • CityUK=Shanghai
  • ProvinceUK=Shanghai
  • ZipCode=200434
  • PhoneArea=021
  • PhoneNumber=51873999
  • FaxArea=021
  • FaxNumber=51873999
  • Email=test@abc.com

输出结果

{
    domain: "zhaomu123.com"
    success: true
    message: "域名注册成功"
}

代码示例

using RestSharp; //使用第三方组件RestSharp

var client = new RestClient();
client.BaseUrl = new Uri("http://BASE_URL");

var request = new RestRequest("/Domain/Register",Method.POST);
request.AddParameter("ApiKey", "testApi");
request.AddParameter("Password", "testPassword");
request.AddParameter("Domain", "zhaomu123.com");
request.AddParameter("Years", "1");
request.AddParameter("OrganizeNameCN", "上海寻义信息科技有限公司");
request.AddParameter("OrganizeNameUK", "Shanghai Xunyi Company");
request.AddParameter("UserNameCN", "张三");
request.AddParameter("UserNameCN", "Zhang San");
request.AddParameter("StreetCN", "虹口区广粤路289号");
request.AddParameter("StreetUK", "GuangYue Road 289,HongKou District");
request.AddParameter("CityCN", "上海市");
request.AddParameter("CityUK", "Shanghai");
request.AddParameter("ProvinceUK", "Shanghai");
request.AddParameter("ZipCode", "200434");
request.AddParameter("PhoneArea", "021");
request.AddParameter("PhoneNumber", "51873999");
request.AddParameter("FaxArea", "021");
request.AddParameter("FaxNumber", "51873999");
request.AddParameter("Email", "test@abc.com");

var response = client.Execute(request);
string result = response.Content;
$url = 'http://BASE_URL/Domain/Register';
$param = array(
  'ApiKey' => 'testApi',
  'Password' => 'testPassword',
  'Domain' => 'zhaomu123.com'    
  'Years' => '1'    
  'OrganizeNameCN' => '上海寻义信息科技有限公司'    
  'OrganizeNameUK' => 'Shanghai Xunyi Company'    
  'UserNameCN' => '张三'    
  'UserNameCN' => 'Zhang San'    
  'StreetCN' => '虹口区广粤路289号'    
  'StreetUK' => 'GuangYue Road 289,HongKou District'    
  'CityCN' => '上海市'    
  'CityUK' => 'Shanghai'    
  'ProvinceUK' => 'Shanghai'    
  'ZipCode' => '200434'    
  'PhoneArea' => '021'    
  'PhoneNumber' => '51873999'    
  'FaxArea' => '021'    
  'FaxNumber' => '51873999'    
  'Email' => 'test@abc.com'    
);
$data = http_build_query($param);

$options = array(
            'http' => array(
                'method' => 'POST',
                'header' => 'Content-Type: application/x-www-form-urlencoded',
                'content' => $data
        ));
$context = stream_context_create($options);
$result = file_get_contents($url, FILE_TEXT, $context);
?>
'API请求的URL地址
const url = "http://BASE_URL/Domain/Register"

'API请求的提交数据
postData = "ApiKey=testApi&Password=testPassword&Domain=zhaomu123.com&Years=1&OrganizeNameCN=上海寻义信息科技有限公司&OrganizeNameUK=Shanghai Xunyi Company&UserNameCN=张三&UserNameCN=Zhang San&StreetCN=虹口区广粤路289号&StreetUK=GuangYue Road 289,HongKou District&CityCN=上海市&CityUK=Shanghai&ProvinceUK=Shanghai&ZipCode=200434&PhoneArea=021&PhoneNumber=51873999&FaxArea=021&FaxNumber=51873999&Email=test@abc.com"

'执行HTTP请求
Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")
http.Open "POST", url, False
http.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
http.Send

'获取并分析结果
result = http.responseText