公共信息定义

1. 请求需要token验证,通过用户名和密码获取token后,在请求header中加上token和对应的值,如:{token:”8rl8iSwhP7wC/7uqDTD1kR/i12LNl/Uc4DfWeRmSjXSFbGCawOMqlw==”};
2. 当执行操作动作的时候,会返回task_id参数,该参数用于查询任务执行的中间状态;
3. 该文档至在版本v1.4时候可用
4. 公共返回参数:code/message,分别用于表示调用该API执行的状态,以及对该状态的描述

公共错误信息定义

错误信息 使用HTTP CODE表示
http code 描述
200 请求成功
404 Not Found
405 请求方法错误
400 参数类型错误
500 程序内部错误
 
1.获取token

选项 描述
功能说明 获取token
调用说明 名称 描述
请求方式 GET
请求类型 HEADER_PARAM
请求路径 http://api2.capitalonline.net/gic/v1/get_token/
参数必选 名称 要求 类型 描述
username True String 用户名
password True String 密码
参数可选
返回结果 说明 返回格式为json
返回参数 名称 类型 描述
Access-Token string 验证后得到的token
status string 验证用户名密码请求的状态
返回示例 {
"status": "success",
 "Access-Token":"UIxWcrSg1v35AukDS2rRj94Q6S+XDiN2jLQHeMSpy4bdDY71lg3isg=="
}

2.查询公网带宽

选项 描述
功能说明 查询公网带宽
调用说明 名称 描述
请求方式 GET
请求类型  
请求路径 http://api2.capitalonline.net/gic/v1/bandwidth/public/{public_id}
参数必选 名称 要求 类型 描述
public_id Ture String 公网pipe的uuid
       
参数可选
返回结果 说明 返回格式为json
返回参数 名称 类型 描述
qos String 公网带宽
code string 执行代码
message string 信息
status string [success(成功) , false(失败)]
返回示例 {
    "status": "success",
    "messsage": "get gpn bandwidth ok!",
    "code": 200,
    "qos": 10
}
错误信息 错误码定义:
Error code Message 描述
get_public_pipe_bandwidth.parameter_error parameter incomplete! 参数不全或者公网id错误
get_public_pipe_bandwidth.exception get public pipe bandwidth exception 获取公网带宽异常

3.获取最近五分钟流量接口

选项 描述
功能说明 获取最近五分钟流量接口
调用说明 名称 描述
请求方式 GET
请求类型  
请求路径 http://api2.capitalonline.net/gic/v1/flow/pipe/{pipe_id}
参数必选 名称 要求 类型 描述
{pipe_id} True String 网络的uuid(可以在虚拟数据中心属性接口中获取)
注意 调用接口需要在header中传递该用户的登录token
返回结果 说明 返回格式为json
返回参数 名称 类型 描述
status string 执行的结果:[success, fail]
code string 代码
data dict 返回数据
message string 错误信息
返回示例 {
    "status": "success",
    "message": "get flow ok.",
    "code": 200,
"data": {
    "last_5_minutes_usage": {
            "out_bps": 0.026,
            "in_bps": 0
        },
        "max_qos": 5
}
}
 
4.更新公网带宽

选项 描述
功能说明 更新公网带宽。
如果当前带宽计费类型为固定带宽时,更新立即生效;
如果当前带宽计费类型为流量包/95峰值时,在续约到期后才会生效。
调用说明 名称 描述
请求方式 POST
请求类型 JSON
请求路径 http://api2.capitalonline.net/gic/v1/public/update/{public_id}
参数必选 名称 要求 类型 描述
area_id True String 销售区域,人民币账户”CN”,美元账户”US”
public_id True String 公网pipe的uuid
qos True Int 当bill_type为number (固定带宽):最大为500M,步长为5M;
当bill_type为amount (流量包),代表流量包大小,单位GB,最大为51200GB(50TB);
当bill_type为peak (95峰值),代表保底带宽,最大为500Mb,步长50;
参数可选 bill_type False String 变更公网计费类型,可选[‘number’(固定带宽), ‘amount’(流量包), ‘peak’(95峰值)], 如果为空,默认为number
is_auto_renewal False Int 只有当前从固定带宽转为流量包/95峰值计费方式时,该参数有效,表示是否自动续约;可选[0(续约关闭), 1(续约开启)]
float_qos False Int 公网类型为95峰值时,带宽大小的封顶带宽,为空时,默认为带宽大小的120%
参数可选
返回结果 说明 返回格式为json
返回参数 名称 类型 描述
task_id string 任务的ID
code string 执行代码
message string 错误信息
status string [success(成功) , false(失败)]
返回示例 {"
"status": "success", 
"code": 200, 
"messsage": "operate_success", 
"task_id": "23470"
}
错误信息 错误码定义:
Error code Message 描述
update_public_pipe_bandwidth.parameter_error parameter incomplete! 参数不全或者公网pipe_id错误
update_public_pipe_bandwidth.no_change qos no change! 带宽没有变化,不需要更新
update_public_pipe_bandwidth.purchase_error purchase error, please contact customer service 算费异常,请联系客服
vm.operation_denied   站点割接,暂时不允许操作
update_public_pipe_bandwidth.order_limit order generation is successful, but the number of goods exceeds the limit, you need to wait for administrator review, task waiting to be executed 订单受限,等待人工审核
update_public_pipe_bandwidth.exception update public pipe bandwidth exception 更新公网带宽异常

5.删除网络

选项 描述
功能说明 删除公网
调用说明 名称 描述
请求方式 DELETE
请求类型  
请求路径 http://api2.capitalonline.net/gic/v1/pipe/{pipe_id}
参数必选 名称 要求 类型 描述
{pipe_id} True String 网络的uuid
参数可选
返回结果 说明 返回格式为json
返回参数 名称 类型 描述
task_id string 任务的ID
code string 执行代码
message string 错误信息
pipe_id String 网络uuid
status string  [success(成功) , false(失败)]
返回示例 {
    "status": "success",
    "message": "OperationSuccess",
    "pipe_id": "adcfd278-5a82-11e5-a71f-0050569b4d9c",
    "task_id": "34873",
    "code": 200
}
错误信息 错误码定义:
Error code Message 描述
public_net.operation_denied permission denied 权拒绝
public_net.invalid_operation the publicnet has deleted 公网已经被删除
task is running in the queue, please wait task end 正在排队
invalid_operation (错误异常信息) 错误异常信息提示
 
6.增加公网IP段

选项 描述
功能说明 创建公网ip
调用说明 名称 描述
请求方式 POST
请求类型 JSON
请求路径 http://api2.capitalonline.net/gic/v1/segment/create/
参数必选 名称 要求 类型 描述
pipe_id Ture String 公网id
area_id True String 销售区域,人民币账户”CN”,美元账户”US”
ip_number True Int ip个数可选(4,8,16,32,64),可用ip为n-3(网络地址,广播地址,网关)
参数可选
返回结果 说明 返回格式为json
返回参数 名称 类型 描述
app_id String 虚拟数据中心的uuid
pipe_id String 公网id
ip_number Int ip个数
task_id string 任务的ID
code string 执行代码
message string 错误信息
status string [success(成功) , false(失败)]
返回示例  
错误信息 错误码定义:
Error code Message 描述
segment.no_money accounts less than the amount 账户没钱
segment. operation_denied   站点割接
  资源互斥,等待任务结束
segment.parameter_error parameter error, please check your parameter pipe 公网id错误
parameter error, please check your parameter ip_number ip个数错误
segment. permission_error permission denied,please check your parameter 权限错误
segment.purchase_error purchase error,  please contact customer servic 计费出错
segment.purchase_exceeds_limit order generation is successful, but the number of goods exceeds the limit, you need to wait for administrator review, task waiting to be executed 购买受限,等待审核
405 request method error 请求方法错误
invalid_operation exception 异常
 
7.删除公网IP

选项 描述
功能说明 删除网卡上的公网IP;
如果当前公网计费类型为固定带宽,IP段删除立即生效;
如果当前公网计费类型为流量包/95峰值,IP段删除在续约到期后生效,请确保续约到期时,IP地址没有被主机使用或标记,否则会删除失败,继续续约。
调用说明 名称 描述
请求方式 DELETE
请求类型  
请求路径 http://api2.capitalonline.net/gic/v1/segment/{segment_id}
参数必选 名称 要求 类型 描述
{segment_id} True String 公网段的uuid
参数可选
返回结果 说明 返回格式为json
返回参数 名称 类型 描述
task_id string 任务的ID
code string 执行代码
message string 错误信息
segment_id String 公网段的uuid
status string [success, false]
返回示例 {
    "status": "success",
    "message": "OperationSuccess",
    "code": 200,
    "task_id": "40140",
    "segment_id": "4d9960c6-5a8d-11e5-8f54-0050569b4d9c"
}
错误信息 错误码定义:
Error code Message 描述
segment.operation_denied permission denied 权限拒绝
the segment has deleted 网段已删除
please disconnect from vm before deleting this segment 删除网段需要把被vm使用的ip释放后才能操作
segment.invalid_operation the segment has deleted 网段已经被删除
task is running in the queue, segment is exec deleting 正在排队执行
invalid_operation (错误异常信息) 错误异常信息提示
 
8.创建私网

选项 描述
功能说明 创建私网
调用说明 名称 描述
请求方式 POST
请求类型 JSON
请求路径 http://api2.capitalonline.net/gic/v1/intranet/create/
参数必选 名称 要求 类型 描述
app_id Ture String  
net_id True String type为auto时,该参数无效
area_id True String 销售区域,人民币账户”CN”,美元账户”US”
mask Ture String type为auto时,该参数无效
参数可选 type False String 私网配置方式,只可选[‘auto’(自动), ‘manual’(手动)],默认为manual
name False String 私网名称
返回结果 说明 返回格式为json
返回参数 名称 类型 描述
app_id String 虚拟数据中心的uuid
net_id String 网络地址
mask String 网络掩码
task_id string 任务的ID
code string 执行代码
message string 错误信息
status string [success(成功) , false(失败)]
返回示例  
错误信息 错误码定义:
Error code Message 描述
intranet.no_money accounts less than the amount 余额不足
intranet.parameter_error parameter incomplete, please check your parameter 参数不全
net_id error 网络号错误
parameter mask or net_id error 网络号和掩码错误
intranet.operation_denied permission denied, please check your parameter 权限错误
the intranet of the app must be not grant than 2 私网个数不能超过2个
  站点割接
  账户审查错误
private network segment already exists 私网段已经存在
405 request method error 请求方法错误
invalid_operation exception 异常

9.流量图

选项 描述
功能说明 对云主机的各网卡流量图
调用说明 名称 描述
请求方式 GET
请求类型 Parameter
请求路径 http://api2.capitalonline.net/gic/v1/nic/networkTranffecImage
参数必选 名称 要求 类型 描述
time True String 时间段["hour1", "hour6", "day1", "day7", "month1", "month12"]
type True String 网络类型[public, gic] 
app_id True String 虚拟数据中心uuid
参数可选
返回结果 说明 返回格式为data
Binary 名称 类型 描述
data 返回png类型的data
返回示例  
错误信息 错误码定义:
Error code Message 描述
image.operation_denied permission denied 权限拒绝
image.parameter_error parameter incomplete, please check your parameter 参数不全
invalid_operation (错误异常信息) 错误异常信息提示
image.invalid_operation please check your parameter 参数错误
 
 10.创建虚实结合网络

选项 描述
功能说明 移除GPN
调用说明 名称 描述
请求方式 POST
请求类型 JSON
请求路径 http://api2.capitalonline.net/gic/v1/vrn/create/
参数必选 名称 要求 类型 描述
vrn_name Ture String vrn名称
vrn_type True String vrn类型
app_id True String 虚拟中心id
area_id True String 销售区域,人民币账户”CN”,美元账户”US”
pipe_id True String 网络的id
vrn_remark True String vrn备注
vrn_position True String vrn的位置
参数可选
返回结果 说明 返回格式为json
返回参数 名称 类型 描述
app_id String 虚拟数据中心的uuid
vrn_name String 虚实结合网络名称
app_id String 虚拟数据中心id
pipe_id String 网络的id
vrn_remark String 备注
vrn_position String Vrn位置
task_id string 任务的ID
code string 执行代码
message string 错误信息
status string [success(成功) , false(失败)]
返回示例  
错误信息 错误码定义:
Error code Message 描述
vrn.parameter_error parameter incomplete, please check your parameter 参数不全
operation_denied permission denied, please check your parameter 权限错误
  割接检查
the app has linked 2 vrn 已经链接了2个vrn
the pipe has linked to vrn 网络已经链接到vrn
this site gpn has linked vrn 此数据中心已经链接到vrn
rn.no_money accounts less than the amount 账户余额不足
invalid_operation exception 异常
 
11.续约操作

选项 描述
功能说明 续约操作(自动续约开关)
调用说明 名称 描述
请求方式 POST
请求类型  
请求路径 http://api2.capitalonline.net/gic/v1/ public/operate/
参数必选 名称 要求 类型 描述
pub_pipe_id
 
True String 网络的uuid
type_id True String 操作类型[“0”,”1”] 其中0为关闭,1为开启
参数可选
返回结果 说明 返回格式为json
返回参数 名称 类型 描述
code_msg string success
code string 执行代码
message string 错误信息
data String  
status string  [success(成功) , false(失败)]
返回示例 {
    "status": "success",
    "code_msg": "success",
    "message": "您的自动续约设置已经保存,
    "code": "0000",
    "data": {}
}
错误信息 错误码定义:
Error code Message 描述
image.operation_denied permission denied 权限拒绝
image.parameter_error parameter incomplete, please check your parameter 参数不全
invalid_operation (错误异常信息) 错误异常信息提示
image.invalid_operation please check your parameter 参数错误

 12.获取最近30s流量接口


选项 描述
功能说明 获取最近30s流量接口(只针对开放30s监控权限的网络)
调用说明 名称 描述
请求方式 GET
请求类型 HEADER_PARAM
请求路径 http://api2.capitalonline.net/gic/v1/flow_30s/pipe/{pipe_id}
参数必选 名称 要求 类型 描述
{pipe_id} TRUE string 网络的uuid(可以在虚拟数据中心属性接口中获取)
注意 调用接口需要在header中传递该用户的登陆token
返回结果 说明 返回格式为json
返回参数 名称 类型 描述
last_30s_minutes_usage dict 最近30s的流量
in_bps float 入网带宽
out_bps float 出网带宽
max_qos int 网络设定的带宽值
返回示例 {
    "last_30s_minutes_usage": {
        "in_bps": 0,
        "out_bps": 0
    },
    "max_qos": 20
}
7x24服务热线
生态合作
价格计算器
7*24小时服务热线
400-810-5300 咨询/购买/备案/建议&投诉
5*8小时售前服务热线
400-810-7006
扫描上方二维码
微信咨询