开发者中心

应用开发API接口

聚合查询传感数据

请求方式及地址

   GET 
   http://api.nlecloud.com/devices/{deviceId}/Datas/Grouping

URL请求参数

参数类型描述其它
deviceId integer 设备ID Required
ApiTags string 传感标识名(可选,多个用逗号分隔,最多50个)
GroupBy integer 聚合方式(1:按分钟分组聚合 2:按小时分组聚合 3:按天分组聚合 4:按月分组聚合),默认2按小时聚合
Func string 聚合函数(与GroupBy配对使用,可以是MAX:按最大值聚合 MIN:按最小值聚合 COUNT:按统计条数聚合),默认MAX最大值聚合
StartDate string 起始时间(必填,格式YYYY-MM-DD HH:mm:ss)
EndDate string 结束时间(可选,格式YYYY-MM-DD HH:mm:ss)默认取当前时间

响应参数

参数类型描述其它
ResultObj SensorDataInfoDTO
Status ResultStatus 返回状态
StatusCode integer 返回的状态码
Msg string 返回的消息
ErrorObj Object

响应示例

{
  "ResultObj": {
    "Count": 4,
    "DeviceId": 1,
    "DataPoints": [
      {
        "ApiTag": "sample string 1",
        "PointDTO": [
          {
            "Value": {},
            "RecordTime": "sample string 2"
          },
          {
            "Value": {},
            "RecordTime": "sample string 2"
          }
        ]
      },
      {
        "ApiTag": "sample string 1",
        "PointDTO": [
          {
            "Value": {},
            "RecordTime": "sample string 2"
          },
          {
            "Value": {},
            "RecordTime": "sample string 2"
          }
        ]
      }
    ]
  },
  "Status": 0,
  "StatusCode": 1,
  "Msg": "sample string 2",
  "ErrorObj": {}
}

模糊查询传感数据

请求方式及地址

   GET 
   http://api.nlecloud.com/devices/{deviceId}/Datas

URL请求参数

参数类型描述其它
deviceId integer 设备ID Required
ApiTags string 传感标识名(可选,多个用逗号分隔,最多50个)
Method integer 查询方式(1:XX分钟内 2:XX小时内 3:XX天内 4:XX周内 5:XX月内 6:按startDate与endDate指定日期查询[默认])
TimeAgo decimal number 与Method一起使用时有效(当Method=1~5时),表示以现在起"多长时间范围内"的数据,例:(Method=2,TimeAgo=30)表示现在起30小时内的历史数据
StartDate string 起始时间[Method为6时有效](可选,格式YYYY-MM-DD HH:mm:ss)
EndDate string 结束时间[Method为6时有效](可选,格式YYYY-MM-DD HH:mm:ss)
Sort string 时间排序方式,DESC:倒序,ASC升序
PageSize integer 指定每次要请求的数据条数,默认20,最多3000
PageIndex integer 指定页码

响应参数

参数类型描述其它
ResultObj SensorDataPageDTO
Status ResultStatus 返回状态
StatusCode integer 返回的状态码
Msg string 返回的消息
ErrorObj Object

响应示例

{
  "ResultObj": {
    "PageCount": 1,
    "PageIndex": 2,
    "RecordCount": 3,
    "Count": 4,
    "DeviceId": 4,
    "DataPoints": [
      {
        "ApiTag": "sample string 1",
        "PointDTO": [
          {
            "Value": {},
            "RecordTime": "sample string 2"
          },
          {
            "Value": {},
            "RecordTime": "sample string 2"
          }
        ]
      },
      {
        "ApiTag": "sample string 1",
        "PointDTO": [
          {
            "Value": {},
            "RecordTime": "sample string 2"
          },
          {
            "Value": {},
            "RecordTime": "sample string 2"
          }
        ]
      }
    ]
  },
  "Status": 0,
  "StatusCode": 1,
  "Msg": "sample string 2",
  "ErrorObj": {}
}

上传传感数据

请求方式及地址

   POST 
   http://api.nlecloud.com/devices/{deviceId}/Datas

URL请求参数

参数类型描述其它
deviceId integer 设备ID Required

包体请求参数

参数类型描述其它
DatasDTO Collection of SensorDataAddDTO 传感数据列表

请求示例

{
  "DatasDTO": [
    {
      "ApiTag": "sample string 1",
      "PointDTO": [
        {
          "Value": {},
          "RecordTime": "sample string 2"
        },
        {
          "Value": {},
          "RecordTime": "sample string 2"
        }
      ]
    },
    {
      "ApiTag": "sample string 1",
      "PointDTO": [
        {
          "Value": {},
          "RecordTime": "sample string 2"
        },
        {
          "Value": {},
          "RecordTime": "sample string 2"
        }
      ]
    }
  ]
}

响应参数

参数类型描述其它
Status ResultStatus 返回状态
StatusCode integer 返回的状态码
Msg string 返回的消息
ErrorObj Object

响应示例

{
  "Status": 0,
  "StatusCode": 1,
  "Msg": "sample string 2",
  "ErrorObj": {}
}