智慧服务,成就美好体验 项目咨询

主页 > 服务与支持 > 开发平台 > 服务端API参考 > 硬终端管理 增加终端

入门使用

增加终端

更新时间:2019-11-20

描述

企业管理员通过该接口添加硬终端。

接口原型

表1 接口原型

请求方法

POST

请求地址

/rest/usg/datacenter/v1/corp/device

传输协议

HTTPS

请求参数

表2 参数说明

参数

是否必须

类型

位置

描述

Authorization

String

Header

授权令牌。将执行鉴权响应的accessToken进行Base64转码操作

样例:Basic Base64(accessToken)

name

String

Body

终端名称,可以自定义,建议为具体位置,方便识别。

长度:1-64。

model

String

Body

终端型号,枚举类型。当前支持TE系列硬件终端,具体的终端类型可以通过获取所有终端类型接口查询。

长度:1-128。

sn

String

Body

终端SN码,仅可包含数字、字母和下划线。

长度:1-30。

deptCode

String

Body

部门编号,默认为根部门。

长度:1-32。

prjCodeMode

String

Body

投影码生成模式,默认为自动。

  • 0:自动

    该模式下根据消息上报的IP地址内部控制复杂度。私网地址配置成简单模式,公网地址配置成复杂模式。

  • 1:简单
  • 2:复杂

phone

String

Body

手机号,必须加上国家码,例如中国大陆手机为“+86xxxxxxxxxxx”。当填写手机号时 “country”参数必填。

手机号只允许输入纯数字。

长度:0-32。

说明:

手机号或者邮箱至少填写一个。

country

String

Body

手机号所属的国家

默认值:chinaPR。

长度:0-255。

email

String

Body

统一邮箱格式。

长度:0-255。

description

String

Body

终端描述。

长度:0-128。

status

Integer

Body

终端状态。

  • 0:正常
  • 1:冻结

默认值:0。

sendNotify

String

Body

是否发送邮件和短信通知。

  • 0:不发送
  • 不填或者其他值就发送

长度:0-32。

响应参数

表3 参数说明

参数

类型

描述

returnCode

String

业务返回码。

returnMessage

String

返回描述。

achievementTime

String

响应产生时间。

requestId

String

请求唯一标识。

data

String

返回终端SN码。

请求消息示例

POST /rest/usg/datacenter/v1/corp/device
Connection: keep-alive
Authorization: Basic ZFZzaWpIank3RVBWWElaZm00Y1BtVFFvbzBRMXc2bnBY
Content-Type: application/json
Content-Length: 155
Host: api.meeting.huaweicloud.com 
User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_191)

{
    "model": "DP300",
    "name": "test5",
    "deptCode": "1",
    "phone": "+86136********",
    "email": "test5@huawei.com",
    "sn": "asdasfscasd",
    "country": "chinaPR"
}
 

响应消息示例

HTTP/1.1 200 
Date: Tue, 16 Apr 2019 09:22:44 GMT
Content-Type: application/json;charset=UTF-8
Content-Length: 164
Connection: keep-alive
Pragma: No-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Server: api-gateway
X-Request-Id: 65c132ec8939a66775df1382e7d35fc9

{
	"returnCode": "000000000",
	"returnMessage": "Success",
	"achievementTime": "2019-04-16 09:21:25.115 UTC",
	"requestId": "e8466aa24cf5d299cecc161ceb2dc4af",
	"data": {
		"name": "test52",
		"type": "TE",
		"model": "DP300",
		"sn": "asdasfscaas",
		"account": "013e65319ab24d9586777114a40441eb",
		"number": "+991116003902",
		"prjCodeMode": null,
		"deptCode": "1",
		"deptName": "chen001",
		"deptNamePath": "chen001",
		"phone": null,
		"country": "chinaPR",
		"email": "test5@huawei.com",
		"description": null,
		"status": 0
	}
}
 

CURL命令示例

curl -k -i -H 'content-type: application/json' -X POST -H 'Authorization: Basic T3IxeXdMUGwzeU9Gb3JnWENNWWZldnBHM0JTQVA5N2FS' -d '{"model": "DP300","name": "test5","deptCode": "1","phone": "+86136********","email": "test5@huawei.com","sn": "asdasfscasd","country": "chinaPR"}' https://api.meeting.huaweicloud.com/rest/usg/datacenter/v1/corp/device