VPS主机相关 - API文档

VPS主机开通

/Vps/Create

API分类 VPS主机相关 请求方法 POST

API简介

实时开通VPS主机,要求用户名下有款。

请求参数

名称 必须 说明
ApiKey API请求时必须提供的密钥,请和管理员联系索取
Password 登录朝暮数据用户管理的密码
VpsID VPS产品编号,可以从订购页面的URL地址中获得,如/Manage/Order/Vps/73
Template 系统模板编号,如Ubuntu14-64
Years 开通时长,可选1-10,整数格式
Cycle 1代表月付,4代表年付

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

请求示例

BASE_URL/Vps/Create

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

  • ApiKey=testApi
  • Password=testPassword
  • VpsID=169
  • Template=Ubuntu14-32
  • Years=2
  • Cycle=1

输出结果

{
    success: true
    info: "VPS主机订购成功"
}

代码示例

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

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

var request = new RestRequest("/Vps/Create",Method.POST);
request.AddParameter("ApiKey", "testApi");
request.AddParameter("Password", "testPassword");
request.AddParameter("VpsID", "169");
request.AddParameter("Template", "Ubuntu14-32");
request.AddParameter("Years", "2");
request.AddParameter("Cycle", "1");

var response = client.Execute(request);
string result = response.Content;
$url = 'http://BASE_URL/Vps/Create';
$param = array(
  'ApiKey' => 'testApi',
  'Password' => 'testPassword',
  'VpsID' => '169'    
  'Template' => 'Ubuntu14-32'    
  'Years' => '2'    
  'Cycle' => '1'    
);
$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/Vps/Create"

'API请求的提交数据
postData = "ApiKey=testApi&Password=testPassword&VpsID=169&Template=Ubuntu14-32&Years=2&Cycle=1"

'执行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