设备录入接口
请求地址
请求参数
字段 |
类型 |
是否必填 |
描述 |
Sn |
string |
是 |
SN序列号 |
Hostname |
string |
是 |
主机名 |
Ip |
string |
是 |
应用IP |
ManageIp |
string |
否 |
管理IP |
NetworkID |
int |
是 |
应用网络资源表(networks)表ID |
ManageNetworkID |
int |
否 |
管理网络资源表(manage_networks)表ID |
OsID |
int |
是 |
操作系统表(os_configs)表ID |
HardwareID |
int |
否 |
硬件配置表(hardwares)表ID |
SystemID |
int |
是 |
系统模板表(system_configs)表ID |
LocationID |
int |
是 |
位置表(locations)表ID |
AssetNumber |
string |
否 |
财编 |
AccessToken |
string |
是 |
调用登录API时,生成的授权AccessToken |
请求参数示例
{
"Sn": "test",
"Hostname": "idcos-test",
"Ip": "192.168.0.3",
"ManageIp": "192.168.1.1",
"NetworkID": 6,
"ManageNetworkID": 1,
"OsID": 2,
"HardwareID": 1,
"SystemID": 1,
"LocationID": 33,
"AssetNumber": "CB20151216001",
"AccessToken": "097B55289D87C26FC33C2B0F7F80701D",
}
请求示例(PHP)
<?php
$data = array(
"Sn" => "test",
"Hostname" => "idcos-test",
"Ip" => "192.168.0.3",
"ManageIp" => "192.168.1.1",
"NetworkID" => 6,
"ManageNetworkID" => 1,
"OsID" => 2,
"HardwareID" => 1,
"SystemID" => 1,
"LocationID" => 33,
"AssetNumber" => "CB20151216001",
"AccessToken" => "097B55289D87C26FC33C2B0F7F80701D",
);
$str = json_encode($data);
$ch = curl_init('http://localhost:8083/api/osinstall/v1/device/add');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $str);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($str))
);
$result = curl_exec($ch);
echo curl_error($ch);
echo $result;
返回参数
字段 |
说明 |
Status |
success/failure |
Message |
提示 |
返回参数示例
{
"Message": "操作成功",
"Status": "success"
}