文档中心 > 查询设备
查询设备

最近更新时间:2023-02-01

1、功能介绍

查询设备列表

2、请求参数

参数

是否必选

参数类型

描述

ActionString系统指定参数。取值:QueryDevice
DeviceIdString按设备ID查询

Name

String

按设备名称查询,支持模糊查询

Type

String

按设备类型查询。取值:ipc、nvr、channel、platform

GroupId

String

按空间ID查询。

指定查询某个空间下设备时必传,不传时默认查询所有空间下设备。

查询所有空间下设备时,仅支持根据设备ID、设备名称查询。(对于通道设备支持传入ParentId查询)

ParentIdString按上级设备ID查询(适用于查询通道设备即Type为channel,查询其他类型设备不要传)
GbDeviceIdString按国标ID查询。

ManageStatus

String

根据设备启用状态查询

启用 active

停用 stop

DeviceStatusString按设备上下线状态查询,在线:online 离线:offline 未注册:unregistered (如果不为空,需要指定GroupId)
PageSizeLong

分页大小,默认为20

PageNumLong第几分页,默认为1

3、响应参数

参数

是否必选

参数类型

描述

RequestId

String

该条接口请求ID

Code

String

0成功

其他失败

Message
String结果信息,成功时为空
Data
Object

返回数据,json对象结构

此接口为空

--PageSize

Long

分页大小,默认为20

--PageNum

Long

第几分页,默认为1

--PageTotal

Long分页总数,默认为1

--TotalCount

Long

设备数量

--DeviceList

array of device objects

设备列表


device定义

参数是否必选参数类型描述
DeviceIdString设备ID
TypeString设备类型。取值:ipc、nvr、channel、platform
NameString设备名称。

GroupId

String

设备所属空间ID。

GroupNameString设备所属空间名称。
ParentIdString上级设备ID
MaxChannelNumLong最大通道数量。
ChannelIdLong通道号
GbDeviceIdString设备国标ID
StreamNameString流名称。
PushUrlString推流地址
UserNameString鉴权用户名(适用于国标空间设备NVR的通道可以不用设置)。

Password

String鉴权密码(适用于国标空间设备NVR的通道可以不用设置)。
ManageStatusString设备管理状态。取值:active(启用)、stop(停用)
GbVersionString

gb28181协议版本号,仅gb28181空间ipc、nvr设备有效。取值:2011、2016。

(仅适用于gb28181空间设备)

Longitude

String

设备经度
LatitudeString设备纬度
DeviceIpString设备IP
DevicePortLong设备端口号
DeviceSnString设备序列号
LastOnlineTime
String

设备最后一次在线时间

格式如:yyyy-MM-ddTHH:mm:ssZ,UTC时间



4、请求示例

请求示例:

查询非通道设备:

GET https://api.unicloud.com/univms?

Action=QueryDevice

&Name=测试设备

&公共请求参数

查询通道设备:

GET https://api.unicloud.com/univms?

Action=QueryDevice

&DeviceId=uni0340031122060938682400

&GroupId=uni0341122060286924475

&ParentId=uni0340021122061775779565

&公共请求参数


返回示例:

非通道设备
{
    "RequestId": "77fc5395-78ec-433f-9f48-519a08647cdf",
    "Code": "0",
    "Data": {
        "PageSize": 20,
        "PageNum": 1,
        "TotalCount": 4,
        "PageTotal": 1,
        "DeviceList": [
            {
                "DeviceId": "uni0340021122061775779565",
                "Type": "nvr",
                "Name": "nvr测试设备",
                "GroupId": "uni0341122060286924475",
                "GroupName": "测试国标空间",
                "ParentId": "",
                "MaxChannelNum": "16",
                "ChannelId": "0",
                "GbDeviceId": "12000000001180570947",
                "UserName": "username",
                "Password": "password",
                "GbVersion": "2011",
                "ManageStatus": "active",
                "DeviceIp": "10.0.0.1",
                "DevicePort": "4321",
                "DeviceSn": "12345",
				"LastOnlineTime": "2022-10-26T07:53:29Z"
            },
            {
                "DeviceId": "uni0340011122061377609622",
                "Type": "ipc",
                "Name": "ipc测试设备",
                "GroupId": "uni0341122060286924475",
                "GroupName": "测试国标空间-0010",
                "ParentId": "",
                "MaxChannelNum": "1",
                "ChannelId": "0",
                "GbDeviceId": "12000000001320914363",
                "UserName": "username",
                "Password": "password",
                "GbVersion": "2011",
                "ManageStatus": "active",
                "DeviceIp": "10.0.0.1",
                "DevicePort": "4321",
                "DeviceSn": "12345",
				"LastOnlineTime": "2022-10-26T07:53:29Z"
            },
            {
                "DeviceId": "uni0340001122062015593783",
                "Type": "ipc",
                "Name": "rtmp测试设备",
                "GroupId": "uni0341122060388608507",
                "GroupName": "测试rtmp空间",
                "ParentId": "",
                "GbDeviceId": "",
                "PushUrl": "rtmp://rtmp.pushdomain.param/uni0341122060388608507/uni0340001122062015593783?token=54d988b7aa65247317a55987ad7c6905&time=1656468060",
                "ManageStatus": "active",
                "Longitude": "52.25",
                "Latitude": "25.52",
                "DeviceIp": "10.0.0.1",
                "DevicePort": "0",
                "DeviceSn": "12345",
				"LastOnlineTime": "2022-10-26T07:53:29Z"
            },
			{
                "DeviceId": "uni0340041122070426267133",
                "Type": "platform",
                "Name": "测试级联设备0004",
                "GroupId": "uni03411202109f70ec206",
                "GroupName": "上海测试空间",
                "ParentId": "",
                "MaxChannelNum": "1",
                "ChannelId": "0",
                "GbDeviceId": "12000000002001000007",
                "UserName": "username",
                "Password": "password",
                "GbVersion": "2011",
                "ManageStatus": "active",
                "DeviceIp": "",
                "DevicePort": "0",
                "DeviceSn": "",
				"LastOnlineTime": "2022-10-26T07:53:29Z"
            }
        ]
    }
}
通道设备(nvr):
{
    "RequestId": "8731b418-9ed8-47a5-87a1-39ffe336b339",
    "Code": "0",
    "Data": {
        "PageSize": 20,
        "PageNum": 1,
        "TotalCount": 1,
        "PageTotal": 1,
        "DeviceList": [
            {
                "DeviceId": "uni0340031122060938682400",
                "Type": "channel",
                "Name": "channel测试设备",
                "GroupId": "uni0341122060286924475",
                "GroupName": "测试国标空间",
                "ParentId": "uni0340021122061775779565",
                "MaxChannelNum": "0",
                "ChannelId": "1",
                "GbDeviceId": "12000000001320130360",
                "GbVersion": "",
                "ManageStatus": "active",
                "DeviceIp": "10.0.0.1",
                "DevicePort": "4321",
                "DeviceSn": "12345",
				"LastOnlineTime": "2022-10-26T07:53:29Z"
            }
        ]
    }
}
通道设备(platform):
{
    "RequestId": "83367a1d-456a-46d8-9080-c0da30cd674b",
    "Code": "0",
    "Data": {
        "PageSize": 20,
        "PageNum": 1,
        "TotalCount": 1,
        "PageTotal": 1,
        "DeviceList": [
            {
                "DeviceId": "uni0340031122071116899151",
                "Type": "channel",
                "Name": "通道一",
                "GroupId": "uni03411202109f70ec206",
                "GroupName": "上海测试空间",
                "ParentId": "uni0340041122070426267133",
                "MaxChannelNum": "0",
                "ChannelId": "0",
                "GbDeviceId": "13050111091327000001",
                "GbVersion": "",
                "ManageStatus": "stop",
                "DeviceIp": "",
                "DevicePort": "0",
                "DeviceSn": "",
				"LastOnlineTime": "2022-10-26T07:53:29Z"
            }
        ]
    }
}


5、状态码

状态码

描述

200

OK

400

Bad Request