查询设备详情 - ShowDevice
功能介绍
查询设备详情。
授权信息
账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限,具体权限要求请参见权限和授权项。
URI
GET /v2/{project_id}/link/instances/{instance_id}/devices/{device_id}
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
project_id |
是 |
String |
项目ID。兼容20.0场景默认为default。项目ID,获取方式请参见API参考的“附录 > 获取项目ID”章节。 |
|
instance_id |
是 |
String |
实例的ID。兼容20.0场景默认为default。 |
|
device_id |
是 |
Integer |
设备ID,该字段为数据库中的自增唯一标识符;通过调用查询设备接口:GET /v2/{project_id}/link/instances/{instance_id}/devices获取响应体中对应设备的device_id字段值。 |
请求参数
|
参数 |
是否必选 |
参数类型 |
描述 |
|---|---|---|---|
|
X-Auth-Token |
是 |
String |
用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 |
响应参数
状态码:200
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
permissions |
Array of strings |
权限。 |
|
id |
Integer |
设备ID,该字段为数据库中的自增唯一标识符;通过调用查询设备接口:GET /v2/{project_id}/link/instances/{instance_id}/devices获取响应体中对应设备的device_id字段值。 |
|
device_id |
Integer |
设备ID(兼容20.0),该字段为数据库中的自增唯一标识符;通过调用查询设备接口:GET /v2/{project_id}/link/instances/{instance_id}/devices获取响应体中对应设备的device_id字段值。 |
|
parent_device_id |
Integer |
父设备ID。 |
|
parent_device_name |
String |
父设备名称。 |
|
product |
ProductReferer object |
产品。 |
|
device_name |
String |
设备名称,支持中文、中文标点符号()。;,:“”、?《》及英文大小写、数字及英文符号()_,#.?'-@%&!, 长度2-64。 |
|
instance_id |
String |
实例ID。 |
|
client_id |
String |
设备客户端ID,平台生成的设备唯一标识。 |
|
node_id |
String |
设备物理编号,通常使用MAC或者IMEI号,支持英文大小写,数字,下划线和中划线,长度2-64。 |
|
app_name |
String |
应用名称。 |
|
status |
Integer |
设备状态,0-启用,1-禁用。 |
|
online_status |
Integer |
是否在线,0-未连接,1-在线,2-离线。 |
|
description |
String |
备注。 |
|
authentication |
Authentication object |
鉴权。 |
|
created_user |
CreatedUser object |
创建时的用户。 |
|
last_updated_user |
LastUpdatedUser object |
最后更新时的用户。 |
|
tags |
Array of strings |
标签。 |
|
created_datetime |
Long |
创建时间,timestamp(ms),使用UTC时区。 |
|
last_updated_datetime |
Long |
最后修改时间,timestamp(ms),使用UTC时区。 |
|
connect_address |
String |
设备接入地址。 |
|
ssl_connect_address |
String |
设备接入SSL地址。 |
|
ipv6_connect_address |
String |
设备接入IPv6地址,在开启IPv6时生效。 |
|
ipv6_ssl_connect_address |
String |
设备接入IPv6 SSL地址,在开启IPv6时生效。 |
|
last_login_datetime |
Long |
最后登录时间。 |
|
node_type |
Integer |
节点类型,0-直连,1-网关,2-子设备。 |
|
device_type |
Integer |
设备类型。
|
|
client_ip |
String |
客户端IP。 |
|
keep_alive |
String |
心跳时间。 |
|
last_active_time |
Long |
最后登录时间。 |
|
version |
String |
设备版本。 |
|
app_id |
String |
应用ID。 |
|
plugin_id |
Integer |
modbus和opcua设备特有,表示插件ID,1-modbus插件,2-opcua插件。 |
|
groups |
Array of integers |
设备所属设备分组的ID |
|
group_names |
Array of strings |
设备所属设备分组的名称 |
|
fingerprint |
String |
证书指纹 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
product_id |
Integer |
产品ID,未填写厂商ID+型号时产品ID必填。 |
|
product_name |
String |
产品名称。 |
|
manufacturer_id |
String |
厂商ID,未填写产品ID时厂商ID和型号必填。 |
|
model |
String |
型号,未填写产品ID时厂商ID和型号必填。 |
|
protocol_type |
Integer |
产品的协议类型:0-mqtt,1-CoAP,2-modbus,4-opcua,5-扩展协议。 |
|
product_type |
Integer |
产品类型:0-普通产品,1-网关产品。 |
|
extend_protocol_name |
String |
扩展协议名称。 |
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
user_name |
String |
一型一密/一机一密的用户名。 |
|
password |
String |
一型一密/一机一密的密码,输入要求:至少1个数字,1个大写字母,1个小写字母,1个特殊字符(~!@#$%^&*()-_=+|[{}];:<>/?),长度16-32个字符 |
状态码:400
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
系统错误码,针对4xx和5xx类HTTP错误码的详细错误码。 |
|
error_msg |
String |
错误描述。 |
|
request_id |
String |
消息ID。 |
状态码:404
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
系统错误码,针对4xx和5xx类HTTP错误码的详细错误码。 |
|
error_msg |
String |
错误描述。 |
|
request_id |
String |
消息ID。 |
状态码:500
|
参数 |
参数类型 |
描述 |
|---|---|---|
|
error_code |
String |
系统错误码,针对4xx和5xx类HTTP错误码的详细错误码。 |
|
error_msg |
String |
错误描述。 |
|
request_id |
String |
消息ID。 |
请求示例
GET /{project_id}/link/instances/{instance_id}/devices/{device_id}
响应示例
状态码:200
OK(如果使用CoAP协议,返回ip为“--”,表示需要先配置外接ELB。)
{
"permissions" : [ "read", "access", "delete", "modify" ],
"id" : 711537,
"device_id" : 711537,
"parent_device_id" : 711536,
"parent_device_name" : "parent-device",
"product" : {
"product_id" : 116303,
"product_name" : "p1",
"manufacturer_id" : "p1",
"model" : "p1",
"product_type" : 0,
"protocol_type" : 0
},
"device_name" : "device",
"instance_id" : "8993a690-cf61-46af-880d-587d823d14e5",
"client_id" : "D116303711537sGDtK",
"node_id" : "string",
"app_name" : "app",
"status" : 0,
"online_status" : 2,
"description" : "device",
"authentication" : {
"user_name" : "F01A8D25FE6E4CF5A286B711B31888AE",
"password" : "************************"
},
"created_user" : {
"user_id" : "",
"user_name" : "user"
},
"last_updated_user" : {
"user_id" : "",
"user_name" : "user"
},
"tags" : [ ],
"created_datetime" : 1607408244841,
"last_updated_datetime" : 1607422571094,
"connect_address" : "xx.xx.xx.xx",
"ssl_connect_address" : "xx.xx.xx.xx",
"ipv6_connect_address" : "xx.xx.xx.xx",
"ipv6_ssl_connect_address" : "xx.xx.xx.xx",
"coap_connect_address" : "xx.xx.xx.xx",
"coap_ssl_connect_address" : "xx.xx.xx.xx",
"coap_ipv6_connect_address" : "xx.xx.xx.xx",
"coap_ipv6_ssl_connect_address" : "xx.xx.xx.xx",
"node_type" : 0,
"device_type" : 0,
"plugin_id" : 2,
"app_id" : "cb4b3ec0-8f7f-432f-b05e-fc149d05da5d"
}
状态码:400
Bad Request
{
"error_code" : "SCB.00000000",
"error_msg" : "Parameter is not valid for operation [romalink.link-device.query]. Parameter is [deviceOid]. Processor is [path].",
"request_id" : "cb39e78a-afd3-4e04-901d-70468b1c23dc-1619602712496-cnnorth7a-P-romalink-service01"
}
状态码:404
Not Found
{
"error_code" : "ROMA.00110006",
"error_msg" : "The resource does not exist. Check whether the resource ID 1 is correct.",
"request_id" : "624c8be1-39b6-47b7-941d-c159aced368a-1619602544650-cnnorth7a-P-romalink-service01"
}
状态码:500
Internal Server Error
{
"error_code" : "ROMA.00110002",
"error_msg" : "The instance does not exist. project_id: 397cd10b30544c588b2f4a56d83856c4, instance_id: f3bb386a-23ec-47aa-9943-4c60ac658611",
"request_id" : "c8c06d0a-be92-4fdf-9d10-bc20131ab158-1619593104919-cnnorth7a-P-romalink-service01"
}
状态码
|
状态码 |
描述 |
|---|---|
|
200 |
OK(如果使用CoAP协议,返回ip为“--”,表示需要先配置外接ELB。) |
|
400 |
Bad Request |
|
404 |
Not Found |
|
500 |
Internal Server Error |
错误码
请参见错误码。