查询设备列表

最近更新时间:2026-03-19 18:16:28

天翼云智能视图服务API

1.查询设备列表

接口功能介绍

本接口用于查询设备列表。

接口约束

URI

GET /devices

路径参数

Query参数

参数是否必填参数类型说明示例下级对象
DirIdString根据设备所属目录ID查询,若DirId和ParentDeviceId均为空,则按照DirId为根目录ID查询。897098424844288
ParentDeviceIdString根据设备所属上级设备ID查询。32388487739092995
DeviceVendorString根据设备厂商查询。海康
DeviceNameString根据设备名称查询。高空抛物摄像头
DeviceTypeString根据设备类型查询。取值:ipc,nvr,platform。ipc
DeviceStatusString根据设备状态查询。取值:on(在线),off(离线),new(未注册)。on
StreamStatusString根据流状态查询。取值:on(在线),off(离线),failed(失败)。on
IncludeDeviceStatsInteger是否返回设备统计信息,默认0。取值:0(不返回),1(返回)。1
IncludeDeviceDirInteger是否返回目录信息,默认0。取值:0(不返回),1(返回)。1
SortByString选择按一个字段排序,默认为CreatedTime,按照创建时间排序。取值:CreatedTime,UpdatedTime。CreatedTime
SortDirectionString排序方式,默认升序。取值:Asc(升序),Desc(降序)。Asc
PageNumInteger第几个分页,默认为1。1
PageSizeInteger分页大小,默认为20。取值范围为1~1000。10

请求参数

请求头header参数

参数是否必填参数类型说明示例下级对象
AuthorizationString认证信息。CT-HMAC-SHA256 Credential=FQ01GA2RR9IJFM1PWIPR/2023-07-18/vss, SignedHeaders=content-type;host;timestamp, Signature=c6e72dffcfb2d25d276e119781e1deb6656d966702191b2bd862d1691e39394f
Content-TypeString互联网媒体类型。application/json;charset=utf-8
HostString主机。vssapi.ctyun.cn
VersionString版本。2021-11-25
TimestampString时间戳。1689643309

请求体body参数

响应参数

参数参数类型说明示例下级对象
statusCodeInteger响应状态码。200
errorString错误码,执行成功时,不返回该字段。VSS_0001
messageString响应信息。请求成功
requestIdString请求ID。362d4e78556b47129182d0881fade86b
returnObjObject响应数据,执行失败时,不返回该字段。returnObj

表 returnObj

参数参数类型说明示例下级对象
DevicesArray of Objects设备列表。Device
DirStatsObject目录信息。DirStats
PageNumInteger第几个分页。1
PageSizeInteger分页大小。10
TotalPageInteger分页总数。1
TotalNumInteger设备总数。10
RequestIdString请求 ID。362d4e78556b47129182d0881fade86b

表 Device

参数参数类型说明示例下级对象
RegionString设备接入区域。0851002
InNetworkTypeString接入网络类型,默认public。取值:public:互联网;private:专线网络。public
OutNetworkTypeString播放网络类型,默认public。接入网络类型。取值:public:互联网;private:专线网络。public
DeviceObject设备信息。DeviceInfo
IndustryObject设备归属行业信息。Industry
VideoDeviceObject视频协议设备信息。VideoDevice
ViidDeviceObject视图协议设备信息。ViidDevice
CreatedTimeString创建时间。1685515845343
UpdatedTimeString更新时间。1685515845343

表 DeviceInfo

参数参数类型说明示例下级对象
DeviceEnabledInteger设备是否启用。取值:0:停用; 1:启用。1
DirIdString设备所属目录ID。600001
ParentDeviceIdString上级设备ID。32388487739092996
DeviceIdString设备ID。32388487739092995
DeviceTypeString设备类型。取值:ipc,nvr,platform。nvr
DeviceVendorString设备厂商。取值:海康,大华,宇视,金三立,华为,科达,其他。海康
DeviceNameString设备名称。摄像头
DeviceLocalNameString设备本地侧名称。摄像头
DeviceIpString设备ip。192.168.0.1
DevicePortInteger设备端口。8000
DeviceMacString设备mac地址。00-16-EA-AE-3C-40
DeviceSerialNumberString设备sn码,仅ipc设备及nvr通道有效。xxx
DeviceModelString设备型号。xxx
DeviceLongitudeString设备经度。11.11
DeviceLatitudeString设备纬度。11.11
DevicePoleIdString设备杆号。xxx
InOrgRegionInteger设备中心编码(8位),按照设备安装所在地的行政区划代码确定,当不是基层单位时空余位为0。行政区划代码采用GB/T 2260-2007规定的行政区划代码表示。35010200
InOrgRegionLevelInteger设备中心编码级别。3
DeviceIndustryCodeString设备所属行业编码。08
DeviceNetworkCodeString设备所属网络标识。取值:0、1、2、3、4:监控报警专网;5:公安信息网;6:政务网;7:Internet网;8:社会资源接入网。7
AutoCreateChannelBoolean是否自动创建子设备。true
DeviceChannelSizeInteger设备通道数量。3
DeviceChannelNumInteger通道号。1
DescriptionString设备描述。描述
DeviceDirObject设备目录信息。DeviceDir
DeviceStatsObject设备统计信息。DeviceStats

表 DeviceDir

参数参数类型说明示例下级对象
ParentDirIdString上级目录ID。600001
DirIdString目录ID。600002
DirNameString目录名称。目录
DirCodeString目录编码。0
DirPathString目录绝对路径。xxx
DescriptionString目录描述。目录描述
CreatedTimeString目录创建时间。1685515845343
UpdatedTimeString目录修改时间。1685515845343

表 DeviceStats

参数参数类型说明示例下级对象
ChannelSizeInteger通道数量。1
MaxChannelSizeInteger最大通道数量。1
OnlineChannelsInteger在线通道数量。1
OfflineChannelsInteger离线通道数量。0
OnlineStreamsInteger在线流数量。1
OfflineStreamsInteger离线流数量。0
FailedStreamsInteger失败流数量。0

表 Industry

参数参数类型说明示例下级对象
InOrgRegionInteger设备中心编码(8位),按照设备安装所在地的行政区划代码确定,当不是基层单位时空余位为0。行政区划代码采用GB/T 2260-2007规定的行政区划代码表示。35010200
InOrgRegionLevelInteger设备中心编码级别。3
DeviceIndustryCodeString设备所属行业编码。3
DeviceIndustryNameString设备所属行业名称。工业
DeviceNetworkCodeString设备所属网络标识。取值:0、1、2、3、4:监控报警专网;5:公安信息网;6:政务网;7:Internet网;8:社会资源接入网。7

表 VideoDevice

参数参数类型说明示例下级对象
InVideoProtocolString接入视频协议分类。取值:gb28181,rtmp,rtsp,ehome。gb28181
Gb28181DeviceObject国标设备。Gb28181Device
EhomeDeviceObjectEhome设备。EhomeDevice
RtmpDeviceObjectRtmp设备。RtmpDevice
RtspDeviceObjectRtsp设备。RtspDevice

表 Gb28181Device

参数参数类型说明示例下级对象
InVersionString接入国标版本。2016
InUserNameString设备用户名,在创建GB28181凭证时生成。test
OutIdString设备国标ID。11000000541327000032
SipIdString国标SIP服务器ID。52010000012008589806
SipIpString国标SIP服务器IP。192.168.0.1
SipTcpPortInteger国标SIP服务器TCP端口。15064
SipUdpPortInteger国标SIP服务器UDP端口。15064
SipTransTypeString国标SIP服务器传输协议。tcp
StreamTransProtocolString媒体流传输协议,默认tcp。取值:tcp,udp。tcp
AutoStartStreamBoolean是否启用自动拉流。true
StreamSizeInteger主子码流数量。1
StreamNumInteger设备发送第几个码流。1
EnabledGB35114Boolean是否启用GB35114协议。true
GB35114ModeIntegerGB35114协议认证方式。取值:1:单向认证;2:双向认证。1
ErrorCodeString错误码。xxx
ErrorMsgString错误信息。xxx
DeviceStatusObject设备状态信息。DeviceStatus
StreamsArray of Objects流状态信息。Stream

表 DeviceStatus

参数参数类型说明示例下级对象
IsOnlineString是否在线。取值:on(在线),off(离线)。on
RegisterTimeString注册时间。1685515845343
UnregisterTimeString注销时间。1685515845343
KeepliveTimeString保活时间。1685515845343

表 Stream

参数参数类型说明示例下级对象
StreamNumInteger第几码流。1
StreamStatusString流状态。on
StreamTransTypeString流传输类型。取值:ps_rtp_udp:PS over RTP UDP;ps_rtp_tcp:PS over RTP TCP;h264_udp:264 over RTP UDP;h264_tcp:H264 over RTP TCP。ps_rtp_udp
RecordStatusString录制状态。取值:on,off。on
RecordTaskIdString录制id。xxx
BitrateString码率。xxx
AudioString音频信息。xxx
VideoObject视频流属性信息。Video

表 Video

参数参数类型说明示例下级对象
CodecString编码格式。取值:h264,h265。h264

表 EhomeDevice

参数参数类型说明示例下级对象
InVersionString接入Ehome版本。2.0
InUserNameStringEhome凭证。test
OutIdString设备国标ID。11000000541327000032
SipIdString国标SIP服务器ID。52010000012008589806
SipIpString国标SIP服务器IP。192.168.0.1
SipTcpPortInteger国标SIP服务器TCP端口。15064
SipUdpPortInteger国标SIP服务器UDP端口。15064
SipTransTypeString国标SIP服务器传输协议。tcp
StreamTransProtocolString媒体流传输协议,默认tcp。取值:tcp,udp。tcp
AutoStartStreamBoolean是否启用自动拉流。true
StreamSizeInteger主子码流数量。1
StreamNumInteger设备发送第几个码流。1
ErrorCodeString错误码。xxx
ErrorMsgString错误信息。xxx
DeviceStatusObject设备状态信息。DeviceStatus
StreamsArray of Objects流状态信息。Streams

表 DeviceStatus

参数参数类型说明示例下级对象
IsOnlineString是否在线。取值:on(在线),off(离线)。on
RegisterTimeString注册时间。1685515845343
UnregisterTimeString注销时间。1685515845343
KeepliveTimeString保活时间。1685515845343

表 Stream

参数参数类型说明示例下级对象
StreamNumInteger第几码流。1
StreamStatusString流状态。on
StreamTransTypeString流传输类型。取值:ps_rtp_udp:PS over RTP UDP;ps_rtp_tcp:PS over RTP TCP;h264_udp:264 over RTP UDP;h264_tcp:H264 over RTP TCP。ps_rtp_udp
RecordStatusString录制状态。取值:on,off。on
RecordTaskIdString录制id。xxx
BitrateString码率。xxx
AudioString音频信息。xxx
VideoObject视频流属性信息。Video

表 Video

参数参数类型说明示例下级对象
CodecString编码格式。取值:h264,h265。h264

表 RtmpDevice

参数参数类型说明示例下级对象
InTypeString视频流接入方式。取值:push(推流),pull(拉流)。push
PushTypeInteger是否自动激活推流地址。1
PushUrlString推流地址。http://example.ctyun.cn/example
OutIdString设备国标ID。11000000541327000032
AutoStartStreamBoolean是否启用自动拉流。true
StreamSizeInteger主子码流数量。1
StreamNumInteger设备发送第几个码流。1
ErrorCodeString错误码。xxx
ErrorMsgString错误信息。xxx
DeviceStatusObject设备状态信息。DeviceStatus
StreamsArray of Objects流状态信息。Streams

表 DeviceStatus

参数参数类型说明示例下级对象
IsOnlineString是否在线。取值:on(在线),off(离线)。on
RegisterTimeString注册时间。1685515845343
UnregisterTimeString注销时间。1685515845343
KeepliveTimeString保活时间。1685515845343

表 Stream

参数参数类型说明示例下级对象
StreamNumInteger第几码流。1
StreamStatusString流状态。on
StreamTransTypeString流传输类型。取值:ps_rtp_udp:PS over RTP UDP;ps_rtp_tcp:PS over RTP TCP;h264_udp:264 over RTP UDP;h264_tcp:H264 over RTP TCP。ps_rtp_udp
RecordStatusString录制状态。取值:on,off。on
RecordTaskIdString录制id。xxx
BitrateString码率。xxx
AudioString音频信息。xxx
VideoObject视频流属性信息。Video

表 Video

参数参数类型说明示例下级对象
CodecString编码格式。取值:h264,h265。h264

表 RtspDevice

参数参数类型说明示例下级对象
InTypeString视频流接入方式。取值:push(推流),pull(拉流)。pull
PullTypeString是否自动拉流。xxx
PullUrlString自定义拉流地址。http://example.ctyun.cn/example
OutIdString设备国标ID。11000000541327000032
UserNameString用户名。test
EnableDomainBoolean是否启用域名。true
DeviceDomainString设备域名。xxx
DeviceIpString设备IP。192.168.0.1
DevicePortInteger设备Port。554
StreamTransProtocolString媒体流传输协议,默认tcp。取值:tcp,udp。tcp
AutoStartStreamBoolean是否启用自动拉流。true
StreamSizeInteger主子码流数量。1
StreamNumInteger设备发送第几个码流。1
ErrorCodeString错误码。xxx
ErrorMsgString错误信息。xxx
DeviceStatusObject设备状态信息。DeviceStatus
StreamsArray of Objects流状态信息。Streams

表 DeviceStatus

参数参数类型说明示例下级对象
IsOnlineString是否在线。取值:on(在线),off(离线)。on
RegisterTimeString注册时间。1685515845343
UnregisterTimeString注销时间。1685515845343
KeepliveTimeString保活时间。1685515845343

表 Stream

参数参数类型说明示例下级对象
StreamNumInteger第几码流。1
StreamStatusString流状态。on
StreamTransTypeString流传输类型。取值:ps_rtp_udp:PS over RTP UDP;ps_rtp_tcp:PS over RTP TCP;h264_udp:264 over RTP UDP;h264_tcp:H264 over RTP TCP。ps_rtp_udp
RecordStatusString录制状态。取值:on,off。on
RecordTaskIdString录制id。xxx
BitrateString码率。xxx
AudioString音频信息。xxx
VideoObject视频流属性信息。Video

表 Video

参数参数类型说明示例下级对象
CodecString编码格式。取值:h264,h265。h264

表 ViidDevice

参数参数类型说明示例下级对象
InViidProtocolString接入视图协议分类。取值:ga1400。ga1400
Ga1400DeviceObjectGa1400设备。Ga1400Device

表 Ga1400Device

参数参数类型说明示例下级对象
InUserIdStringGA1400凭证id。20720122
InUserNameStringGA1400凭证名称。test
DeviceTypeString视图库设备类型。取值:ape(采集设备)。ape
ViidIdString视图库编码。xxx
ViidIpString视图库ip。192.168.0.1
ViidPortInteger视图库端口。8000
OutIdString设备视图编码。11000000541327000032
IpString设备ip。192.168.0.1
PortInteger设备端口。8000
DeviceStatusObject设备状态。DeviceStatus

表 DeviceStatus

参数参数类型说明示例下级对象
IsOnlineString是否在线。取值:on(在线),off(离线)。on
RegisterTimeString注册时间。1685515845343
UnregisterTimeString注销时间。1685515845343
KeepliveTimeString保活时间。1685515845343

请求示例

请求url

GET '/devices?PageNum=1&PageSize=1'

请求头header

{
    "Authorization": "CT-HMAC-SHA256 Credential=SBGX5QWGRAC5QMDQUXIZ/2023-05-31/vss, SignedHeaders=content-type;host;timestamp, Signature=c6edf94e2818ea95efe00ce44a20cdb6a97d8057bec4995573a9b0b250459133",
    "Content-Type": "application/json;charset=utf-8",
    "Host": "vssapi.ctyun.cn",
    "Version": "2021-11-25",
    "Timestamp": "1689643309"
}

请求体body

响应示例

{
  "statusCode": 200,
  "message": "请求成功",
  "requestId": "683d89badd0449b7bb27ea588eae2300",
  "returnObj": {
    "Devices": [
      {
        "Device": {
          "DirId": "1",
          "DeviceId": "743780360209498112",
          "ParentDeviceId": "-1",
          "DeviceType": "ipc",
          "DeviceVendor": "海康",
          "DeviceName": "openapi-v2-change",
          "DeviceLocalName": "",
          "DeviceIp": "",
          "DevicePort": "0",
          "DeviceSerialNumber": "",
          "DeviceModel": "",
          "InOrgRegion": "11000000",
          "InOrgRegionLevel": 1,
          "DeviceLongitude": "0",
          "DeviceLatitude": "0",
          "DeviceMac": "",
          "DevicePoleId": "",
          "DeviceIndustryCode": "54",
          "DeviceNetworkCode": "7",
          "AutoCreateChannel": false,
          "DeviceChannelSize": 1,
          "DeviceChannelNum": -1,
          "DeviceEnabled": 1,
          "Description": "",
          "DeviceDir": null,
          "DeviceStats": null,
          "DeviceChannels": []
        },
        "VideoDevice": {
          "Gb28181Device": {
            "SipId": "52010000012008589806",
            "SipIp": "vssapi.ctyun.cn",
            "SipTcpPort": "15064",
            "SipUdpPort": "15064",
            "OutId": "11000000541327000032",
            "DeviceStatus": {
              "IsOnline": "new",
              "RegisterTime": "1685515845345",
              "KeepliveTime": "0",
              "UnregisterTime": "0"
            },
            "Streams": [],
            "ErrorCode": "",
            "ErrorMsg": "",
            "InUserName": "123",
            "StreamTransProtocol": "tcp",
            "SipTransType": "tcp",
            "InVersion": "2016",
            "StreamSize": 1,
            "AutoStartStream": true,
            "StreamNum": 1,
            "EnabledGB35114": false,
            "GB35114Mode": 0
          },
          "EhomeDevice": null,
          "RtmpDevice": null,
          "RtspDevice": null,
          "InVideoProtocol": "gb28181"
        },
        "ViidDevice": null,
        "IotDevice": null,
        "Industry": {
          "InOrgRegion": "11000000",
          "InOrgRegionLevel": 1,
          "IndustryCode": "54",
          "IndustryName": "",
          "NetworkCode": "7"
        },
        "Region": "0851001",
        "InNetworkType": "public",
        "OutNetworkType": "public",
        "CreatedTime": "1685515845343",
        "UpdatedTime": "1685516000079"
      }
    ],
    "DirStats": null,
    "PageNum": "1",
    "PageSize": "1",
    "TotalPage": "144",
    "TotalNum": "144",
    "RequestId": "683d89badd0449b7bb27ea588eae2300"
  }
}

状态码

请参考状态码说明。

错误码

请参考错误码说明。