项目 HTTP API
项目 HTTP API为您提供了项目级别的API接口,包括对项目、设备、产品、服务信息等全面的资源访问,采用HTTP RESTful风格.
准备工作
创建项目获得API密钥
在JieIOT平台,进入项目管理页面,点击项目列表,即可看到项目表页面,点击新增按钮,即可创建您的项目。
在项目新增页面,填写项目信息,并点击确认按钮,即可创建项目。这里的项目信息您可以在操作栏->修改中随时修改
注意:此处的第三方回调地址需要根据您的部署环境填写,详情请查看 消息回调
项目创建好之后,点击项目列表页面操作栏的详情按钮,进入即可获取 ProjectID 和 API Key,用于请求API时的身份验证。
在项目详情页面->基本信息部分,可获得项目的 ProjectID 和 API Key。点击 Access Key 和 Secret Key右侧的复制按钮,即可获取。
如何获得项目API接入地址
在JieIOT平台,进入您刚刚创建的项目详情页面,点击基本信息,即可看到项目API接入地址
不同项目的API接入点地址可能不同,请您以控制台获取的地址为准。
API请求代码示例
以获取API AccessToken为例,以下是常用编程语言请求API的代码示例,仅供参考:
func main() {
pubservice.ApiClient().SetAddress("https://<api-endpoint>/api/v1/access_token")
pubservice.ApiClient().SetToken(token)
if token == "" {
res, err := pubservice.ApiClient().AccessToken(ctx, &v1.AccessTokenReq{
AccessTokenInput: &pubmodel.AccessTokenInput{
ProjectId: <project_id>,
AccessKey: "<access_key>",
SecretKey: "<secret_key>",
},
})
if err != nil {
g.Log().Errorf(ctx, "AccessToken error: %v", err)
return
}
g.Log().Infof(ctx, "AccessToken res: %+v", res)
g.Log().Infof(ctx, "AccessToken AccessTokenOutput: %+v", res.Data.AccessTokenOutput)
}
productList(ctx)
}
func productList(ctx context.Context) {
res, err := pubservice.ApiClient().ProductList(ctx, &v1.ProductListReq{
ProductListInput: &pubmodel.ProductListInput{
Page: 1,
PageSize: 100,
},
})
if err != nil {
g.Log().Errorf(ctx, "ProductList error: %v", err)
return
}
g.Log().Infof(ctx, "ProductList res: %+v", res)
g.Log().Infof(ctx, "ProductList Total: %+v", res.Data.Total)
for k, v := range res.Data.List {
g.Log().Infof(ctx, "ProductList List index: %d, item: %+v", k, v)
}
}import requests
import json
api_url = "https://<api-endpoint>/api/v1/access_token"
post_data = {
"accessTokenInput": {
"projectId": "<project_id>",
"accessKey": "<access_key>",
"secretKey": "<secret_key>"
}
}
try:
response = requests.post(api_url, json=post_data, headers={"Content-Type": "application/json"})
response.raise_for_status()
print("AccessToken res:", json.dumps(response.json(), indent=2))
except requests.RequestException as e:
print("AccessToken error:", e)const axios = require('axios');
const postData = {
accessTokenInput: {
projectId: '<project_id>',
accessKey: '<access_key>',
secretKey: '<secret_key>'
}
};
axios.post('https://<api-endpoint>/api/v1/access_token', postData, {
headers: {
'Content-Type': 'application/json'
}
})
.then(response => {
console.log('AccessToken res:', response.data);
console.log('AccessTokenOutput:', response.data?.data?.accessTokenOutput);
})
.catch(error => {
console.error('AccessToken error:', error.response ? error.response.data : error.message);
});<?php
$url = "https://<api-endpoint>/api/v1/access_token";
$postData = [
"accessTokenInput" => [
"projectId" => "<project_id>",
"accessKey" => "<access_key>",
"secretKey" => "<secret_key>"
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postData));
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo "AccessToken error: " . curl_error($ch);
} else {
echo "AccessToken res: " . $response . PHP_EOL;
}
curl_close($ch);import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class AccessTokenExample {
public static void main(String[] args) {
String apiUrl = "https://<api-endpoint>/api/v1/access_token";
String jsonData = """
{
"accessTokenInput": {
"projectId": "<project_id>",
"accessKey": "<access_key>",
"secretKey": "<secret_key>"
}
}
""";
try {
URL url = new URL(apiUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
try (OutputStream os = conn.getOutputStream()) {
byte[] input = jsonData.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
// 读取响应
try (var br = new java.io.BufferedReader(
new java.io.InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8))) {
StringBuilder response = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
response.append(line.trim());
}
System.out.println("AccessToken res: " + response);
}
} catch (Exception e) {
System.err.println("AccessToken error: " + e.getMessage());
}
}
}using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
var apiUrl = "https://<api-endpoint>/api/v1/access_token";
var jsonData = @"{
""accessTokenInput"": {
""projectId"": ""<project_id>"",
""accessKey"": ""<access_key>"",
""secretKey"": ""<secret_key>""
}
}";
using (var client = new HttpClient())
{
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
try
{
var response = await client.PostAsync(apiUrl, content);
var responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine("AccessToken res: " + responseBody);
}
catch (Exception ex)
{
Console.WriteLine("AccessToken error: " + ex.Message);
}
}
}
}获取API AccessToken
在使用平台的API之前,需要先调用身份验证接口获取API AccessToken,作为API请求的认证信息。
服务器获取AccessToken
通过服务器发起请求,获取AccessToken。
Request Syntax
POST /api/v1/auth/accessToken
Content-Type: application/json
{
"projectId": 0,
"accessKey": "string",
"secretKey": "string"
}Request Body
| Field | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | 在JieIOT平台项目详情中获取 |
accessKey | string | Yes | 在JieIOT平台项目详情中获取 |
secretKey | string | Yes | 在JieIOT平台项目详情中获取 |
Response Syntax
200 Response
Content-Type: application/json
{
"Token": "string"
}项目信息
读取项目信息
读取当前项目的信息。
Request Syntax
GET /api/v1/project/info
Content-Type: application/json
Authorization: Bearer < AccessToken >Response Syntax
200 Response
Content-Type: application/json
{
"projectId": 0,
"projectName": "string",
"longitude": 0,
"latitude": 0,
"region": "string",
"address": "string",
"contactUser": "string",
"contactPhone": "string",
"status": "string",
"tenantId": "string",
"deptId": 0,
"createdDept": 0,
"createdBy": 0,
"createdAt": "string",
"updatedBy": 0,
"updatedAt": "string",
"remark": "string"
}读取设备状态统计
读取项目中所有设备基本状态的统计。
Request Syntax
GET /api/v1/project/devicesStat
Content-Type: application/json
Authorization: Bearer < AccessToken >Response Syntax
200 Response
Content-Type: application/json读取设备告警状态统计
读取项目中所有设备告警状态的统计。
Request Syntax
GET /api/v1/project/devicesAlarmStat
Content-Type: application/json
Authorization: Bearer < AccessToken >Response Syntax
200 Response
Content-Type: application/json设备管理
读取设备列表
读取所有设备列表
Request Syntax
GET /api/v1/device/list
Content-Type: application/json
Authorization: Bearer < AccessToken >Query Parameters
| 名称 | 类型 | 说明 |
|---|---|---|
| page | integer(int) | none |
| pageSize | integer(int) | none |
| productKey | string(string) | 产品标识 |
| createdAt | array([]string) | 创建时间 |
Response Syntax
200 Response
Content-Type: application/json
{
"list": [
{
"deviceKey": "string",
"deviceName": "string",
"productKey": "string",
"productName": "string",
"alarmState": 0,
"createdAt": "string",
"rssi": 0,
"deviceState": 0,
"lastOnlineTime": "string",
"imgUrl": "string"
}
],
"total": 0
}| 名称 | 类型 | 说明 |
|---|---|---|
| deviceKey | string(string) | 设备标识 |
| deviceName | string(string) | 设备名称 |
| productKey | string(string) | 产品标识 |
| productName | string(string) | 产品名称 |
| alarmState | integer(int) | 告警状态(0:正常 1:告警) |
| createdAt | string(string) | 创建时间 |
| rssi | integer(int) | 信号强度 |
| deviceState | integer(int) | 设备状态(1-未激活,2-在线,3-离线) |
| lastOnlineTime | string(string) | 最后在线时间 |
| imgUrl | string(string) | 设备图片 |
读取设备基本信息
读取指定设备的基本信息。
Request Syntax
GET /api/v1/device/baseinfo
Content-Type: application/json
Authorization: Bearer < AccessToken >Query Parameters
| 名称 | 类型 | 说明 |
|---|---|---|
| deviceKey | string(string) | 设备标识 |
Response Syntax
200 Response
Content-Type: application/json
{
"tenantId": "string",
"deviceKey": "string",
"deviceName": "string",
"deviceSrcName": "string",
"productKey": "string",
"productName": "string",
"productCategoryId": 0,
"productCategoryName": "string",
"alarmState": 0,
"createdAt": "string",
"rssi": 0,
"deviceState": 0,
"lastOnlineTime": "string",
"imgUrl": "string",
"activeTime": "string",
"warrantyEndTime": "string",
"platformEndTime": "string",
"iccid": "string",
"imsi": "string",
"imei": "string",
"mac": "string",
"deviceModel": "string",
"wifiSsid": "string",
"wifiIp": "string",
"firmwareVersion": "string",
"hardwareVersion": "string",
"longitude": 0,
"latitude": 0,
"shareConsumerId": 0
}| 名称 | 类型 | 说明 |
|---|---|---|
| tenantId | string(string) | 租户ID |
| deviceKey | string(string) | 设备标识 |
| deviceName | string(string) | 设备名称 |
| deviceSrcName | string(string) | 设备来源名称 |
| productKey | string(string) | 产品标识 |
| productName | string(string) | 产品名称 |
| productCategoryId | integer(int64) | 产品分类ID |
| productCategoryName | string(string) | 产品分类名称 |
| alarmState | integer(int) | 告警状态(0:正常 1:告警) |
| createdAt | string(string) | 创建时间 |
| rssi | integer(int) | 信号强度 |
| deviceState | integer(int) | 设备状态(1-未激活,2-在线,3-离线) |
| lastOnlineTime | string(string) | 最后在线时间 |
| imgUrl | string(string) | 设备图片 |
| activeTime | string(string) | 激活时间 |
| warrantyEndTime | string(string) | 质保结束时间 |
| platformEndTime | string(string) | 平台服务结束时间 |
| iccid | string(string) | ICCID |
| imsi | string(string) | IMSI |
| imei | string(string) | IMEI |
| mac | string(string) | MAC |
| deviceModel | string(string) | 设备型号 |
| wifiSsid | string(string) | WIFI SSID |
| wifiIp | string(string) | WIFI IP |
| firmwareVersion | string(string) | 固件版本号 |
| hardwareVersion | string(string) | 硬件版本号 |
| longitude | number(float64) | 设备坐标(经度) |
| latitude | number(float64) | 设备坐标(纬度) |
| shareConsumerId | integer(int64) | 共享用户ID |
读取设备详情
读取设备详情
Request Syntax
GET /api/v1/device/info
Content-Type: application/json
Authorization: Bearer < AccessToken >Query Parameters
| 名称 | 类型 | 说明 |
|---|---|---|
| deviceKey | string(string) | 设备标识 |
Response Syntax
200 Response
Content-Type: application/json
{
"deviceKey": "string",
"deviceName": "string",
"productKey": "string",
"productName": "string",
"alarmState": 0,
"createdAt": "string",
"rssi": 0,
"deviceState": 0,
"lastOnlineTime": "string",
"properties": {
"property1": {
"key": "string",
"name": "string",
"type": "string",
"unit": "string",
"value": {},
"ts": "string"
},
"property2": {
"key": "string",
"name": "string",
"type": "string",
"unit": "string",
"value": {},
"ts": "string"
}
},
"tsl": {
"key": "string",
"name": "string",
"properties": [
{
"key": "string",
"name": "string",
"order": 0,
"desc": "string",
"extFlag": {
"isChart": 0,
"isMonitor": 0,
"isReadonly": 0,
"isHistory": 0,
"isSharePerm": 0
},
"valueType": {
"type": "string",
"max": 0,
"min": 0,
"decimals": 0,
"unit": "string",
"step": 0,
"trueText": "string",
"falseText": "string",
"maxLength": 0,
"invalidAction": 0,
"fromType": "string",
"formula": "string",
"defaultValue": "string",
"enumList": [
null
],
"itemType": "string",
"arrayCount": 0,
"itemKeys": [
null
],
"items": [
null
]
},
"mapping": {
"type": "string",
"key": "string"
}
}
],
"functions": [
{
"key": "string",
"name": "string",
"order": 0,
"inputs": [
{
"key": null,
"name": null,
"order": null,
"desc": null,
"extFlag": null,
"valueType": null,
"mapping": null
}
],
"outputs": [
{
"key": null,
"name": null,
"order": null,
"desc": null,
"extFlag": null,
"valueType": null,
"mapping": null
}
],
"desc": "string",
"extFlag": {
"isHistory": 0,
"isSharePerm": 0
}
}
],
"events": [
{
"key": "string",
"name": "string",
"order": 0,
"inputs": [
{
"key": null,
"name": null,
"order": null,
"desc": null,
"extFlag": null,
"valueType": null,
"mapping": null
}
],
"desc": "string",
"extFlag": {
"isHistory": 0,
"isSharePerm": 0
}
}
],
"tags": [
{
"key": "string",
"name": "string",
"order": 0,
"desc": "string",
"extFlag": {
"isChart": 0,
"isMonitor": 0,
"isReadonly": 0,
"isHistory": 0,
"isSharePerm": 0
},
"valueType": {
"type": "string",
"max": 0,
"min": 0,
"decimals": 0,
"unit": "string",
"step": 0,
"trueText": "string",
"falseText": "string",
"maxLength": 0,
"invalidAction": 0,
"fromType": "string",
"formula": "string",
"defaultValue": "string",
"enumList": [
null
],
"itemType": "string",
"arrayCount": 0,
"itemKeys": [
null
],
"items": [
null
]
},
"mapping": {
"type": "string",
"key": "string"
}
}
],
"extConfig": {
"gpsConfig": {
"latAndLongKey": "string",
"latitudeKey": "string",
"longitudeKey": "string"
},
"simCardConfig": {
"iccidKey": "string",
"imsiKey": "string"
},
"tsdbConfig": {
"storePolicy": 0
},
"tagsConfig": {
"property1": "string",
"property2": "string"
}
}
},
"imgUrl": "string",
"deviceConfig": "string"
}| 名称 | 类型 | 说明 |
|---|---|---|
| deviceKey | string(string) | 设备标识 |
| deviceName | string(string) | 设备名称 |
| productKey | string(string) | 产品标识 |
| productName | string(string) | 产品名称 |
| alarmState | integer(int) | 告警状态(0:正常 1:告警) |
| createdAt | string(string) | 创建时间 |
| rssi | integer(int) | 信号强度 |
| deviceState | integer(int) | 设备状态(1-未激活,2-在线,3-离线) |
| lastOnlineTime | string(string) | 最后在线时间 |
| imgUrl | string(string) | 设备图片 |
| deviceConfig | string(string) | 设备配置信息 |
读取设备属性列表
读取设备属性列表
Request Syntax
GET /api/v1/device/getProperty
Content-Type: application/json
Authorization: Bearer < AccessToken >Query Parameters
| 名称 | 类型 | 说明 |
|---|---|---|
| device_key | string(string) | none |
Response Syntax
200 Response
Content-Type: application/json
{
"device_key": "string",
"properties": {
"property1": {
"key": "string",
"name": "string",
"type": "string",
"unit": "string",
"value": {},
"ts": "string"
},
"property2": {
"key": "string",
"name": "string",
"type": "string",
"unit": "string",
"value": {},
"ts": "string"
}
}
}| 名称 | 类型 | 说明 |
|---|---|---|
| device_key | string(string) | 设备标识 |
| properties | object(map[string]*DevicePropertyCache) | 属性列表 |
设备属性采集
进行设备属性主动采集
Request Syntax
POST /api/v1/device/propertyCollect
Content-Type: application/json
Authorization: Bearer < AccessToken >
{
"msg_id": "string",
"tenant_id": "string",
"product_key": "string",
"device_key": "string",
"is_all_property": true,
"property_keys": [
"string"
],
"is_async": true,
"sync_timeout": 0,
"cmd_interval": 0,
"fail_retry": 0,
"fail_continue": true,
"consumerId": 0
}Query Parameters
| 名称 | 类型 | 说明 |
|---|---|---|
| msg_id | string(string) | 消息ID,可不填 |
| tenant_id | string(string) | 租户ID,可不填 |
| product_key | string(string) | 产品标识 |
| device_key | string(string) | 设备标识 |
| is_all_property | boolean(bool) | 是否采集所有属性 |
| property_keys | [string] | 采集指定属性 |
| is_async | boolean(bool) | 是否异步调用,同步调用:false,异步调用:true 同步调用等待设备响应 |
| sync_timeout | integer(int) | 同步超时时间秒 未填写默认10秒 |
| cmd_interval | integer(int) | 多条采集指令间隔时间秒 |
| fail_retry | integer(int) | 单条采集指令失败再重试次数 0是不重试 |
| fail_continue | boolean(bool) | 单条采集指令失败是否继续执行后续采集指令 默认false |
| consumerId | integer(int64) | 操作用户,选填 |
Response Syntax
200 Response
Content-Type: application/json
{
"msg_id": "string",
"tenant_id": "string",
"product_key": "string",
"device_key": "string",
"code": 0,
"message": "string"
}| 名称 | 类型 | 说明 |
|---|---|---|
| msg_id | string(string) | 消息ID |
| tenant_id | string(string) | 租户ID |
| product_key | string(string) | 产品标识 |
| device_key | string(string) | 设备标识 |
| code | integer(int) | 状态码 |
| message | string(string) | 状态信息 |
设备属性设置
进行设备属性设置
Request Syntax
POST /api/v1/device/propertySet
Content-Type: application/json
Authorization: Bearer < AccessToken >
{
"msg_id": "string",
"tenant_id": "string",
"product_key": "string",
"device_key": "string",
"input": {
"property1": {},
"property2": {}
},
"is_async": true,
"sync_timeout": 0,
"consumerId": 0
}Query Parameters
| 名称 | 类型 | 说明 |
|---|---|---|
| msg_id | string(string) | 消息ID,可不填 |
| tenant_id | string(string) | 租户ID |
| product_key | string(string) | 产品标识 |
| device_key | string(string) | 设备标识 |
| input | object(map[string]interface) | 输入参数 |
| is_async | boolean(bool) | 是否异步调用,同步调用:false,异步调用:true 同步调用等待设备响应 |
| sync_timeout | integer(int) | 同步超时时间秒 默认10秒 |
| consumerId | integer(int64) | 操作用户,选填 |
Response Syntax
200 Response
Content-Type: application/json
{
"msg_id": "string",
"tenant_id": "string",
"product_key": "string",
"device_key": "string",
"code": 0,
"message": "string"
}| 名称 | 类型 | 说明 |
|---|---|---|
| msg_id | string(string) | none |
| tenant_id | string(string) | none |
| product_key | string(string) | none |
| device_key | string(string) | none |
| code | integer(int) | none |
| message | string(string) | none |
获取设备历史属性
获取设备历史属性
Request Syntax
GET /api/v1/device/historyPropertyStat
Content-Type: application/json
Authorization: Bearer < AccessToken >Query Parameters
| 名称 | 类型 | 说明 |
|---|---|---|
| device_key | string(string) | 设备标识 |
| property_key | string(string) | 属性标识 |
| start_time | string(string) | 开始时间 |
| end_time | string(string) | 结束时间 |
| is_asc | boolean(bool) | 是否升序 |
| aggregate_window | string(string) | 聚合窗口,示例:10s,1m,1h,1d |
| aggregate_function | string(string) | 聚合函数,示例:AVG,SUM,MIN,MAX,COUNT,PERCENTILE |
| page | integer(int) | 页码 |
| pageSize | integer(int) | 每页大小 |
Response Syntax
200 Response
Content-Type: application/json
{
"page": 0,
"pageSize": 0,
"total": 0,
"data": [
{
"key": "string",
"name": "string",
"type": "string",
"unit": "string",
"value": {},
"ts": "string"
}
]
}获取设备历史事件
获取设备历史事件
Request Syntax
GET /api/v1/device/historyEventStat
Content-Type: application/json
Authorization: Bearer < AccessToken >Query Parameters
| 名称 | 类型 | 说明 |
|---|---|---|
| device_key | string(string) | 设备标识 |
| event_key | string(string) | 事件标识 |
| event_params | array([]string) | 事件输入参数列表 |
| start_time | string(string) | 开始时间 |
| end_time | string(string) | 结束时间 |
| is_asc | boolean(bool) | 是否升序 |
| aggregate_window | string(string) | 聚合窗口,示例:10s,1m,1h,1d |
| aggregate_function | string(string) | 聚合函数,示例:AVG,SUM,MIN,MAX,COUNT,PERCENTILE |
| page | integer(int) | 页码 |
| pageSize | integer(int) | 每页大小 |
Response Syntax
200 Response
Content-Type: application/json
{
"page": 0,
"pageSize": 0,
"total": 0,
"data": {
"property1": [
{
"key": "string",
"name": "string",
"type": "string",
"unit": "string",
"value": {},
"ts": "string"
}
],
"property2": [
{
"key": "string",
"name": "string",
"type": "string",
"unit": "string",
"value": {},
"ts": "string"
}
]
}
}设备功能调用
进行设备功能调用
Request Syntax
POST /api/v1/device/functionDo
Content-Type: application/json
Authorization: Bearer < AccessToken >
{
"msg_id": "string",
"tenant_id": "string",
"product_key": "string",
"device_key": "string",
"function_key": "string",
"input": {
"property1": {},
"property2": {}
},
"is_async": true,
"sync_timeout": 0,
"consumerId": 0
}Query Parameters
| 名称 | 类型 | 说明 |
|---|---|---|
| msg_id | string(string) | 消息ID,可不填 |
| tenant_id | string(string) | 租户ID |
| product_key | string(string) | 产品标识 |
| device_key | string(string) | 设备标识 |
| input | object(map[string]interface) | 输入参数 |
| is_async | boolean(bool) | 是否异步调用,同步调用:false,异步调用:true 同步调用等待设备响应 |
| sync_timeout | integer(int) | 同步超时时间秒 默认10秒 |
| consumerId | integer(int64) | 操作用户,选填 |
Response Syntax
200 Response
Content-Type: application/json
{
"msg_id": "string",
"tenant_id": "string",
"product_key": "string",
"device_key": "string",
"function_key": "string",
"code": 0,
"message": "string",
"output": {
"property1": {},
"property2": {}
}
}| 名称 | 类型 | 说明 |
|---|---|---|
| msg_id | string(string) | none |
| tenant_id | string(string) | none |
| product_key | string(string) | none |
| device_key | string(string) | none |
| code | integer(int) | none |
| message | string(string) | none |
读取设备操作日志列表
读取设备操作日志列表
Request Syntax
GET /api/v1/device/optLogList
Content-Type: application/json
Authorization: Bearer < AccessToken >
{
"page": 1,
"pageSize": 1,
"keyword": "string",
"createdAt": [
"string"
],
"gtLogId": 0,
"ltLogId": 0,
"isAsc": true,
"deviceKey": "string"
}Query Parameters
| 名称 | 类型 | 说明 |
|---|---|---|
| page | integer(int) | 页码 |
| pageSize | integer(int) | 每页大小 |
| keyword | string(string) | 关键字 |
| createdAt | array([]string) | 创建时间 |
| gtLogId | integer(int64) | 大于日志ID, 非必填 |
| ltLogId | integer(int64) | 小于日志ID, 非必填 |
| isAsc | boolean(bool) | 是否升序 |
| deviceKey | string(string) | 设备标识 |
Response Syntax
200 Response
Content-Type: application/json
{
"list": [
{
"logId": 0,
"consumerId": 0,
"deviceKey": "string",
"optType": 0,
"optTitle": "string",
"isAsync": 0,
"resCode": 0,
"resMessage": "string",
"createdAt": "string"
}
],
"total": 0
}| 名称 | 类型 | 说明 |
|---|---|---|
| logId | integer(int64) | 自增ID |
| consumerId | integer(int64) | 操作用户 |
| deviceKey | string(string) | 设备标识 |
| optType | integer(uint) | 类型;100:功能调用,101:分组功能调用,102:属性设置,103:分组属性设置,104:属性采集 |
| optTitle | string(string) | 消息标题 |
| isAsync | integer(int) | 是否异步 |
| resCode | integer(int) | 响应码 |
| resMessage | string(string) | 响应描述 |
| createdAt | string(*gtime.Time) | 创建时间 |
读取设备操作日志详情
读取设备操作日志详情
Request Syntax
GET /api/v1/device/optLogView
Content-Type: application/json
Authorization: Bearer < AccessToken >
{
"id": 0,
"consumerId": 0,
"optType": "string",
"optContent": "string",
"createdAt": "string"
}Query Parameters
| 名称 | 类型 | 说明 |
|---|---|---|
| id | integer(int64) | ID |
| consumerId | integer(int64) | 用户ID |
| optType | string(string) | 操作类型 |
| optContent | string(string) | 操作内容 |
| createdAt | string(string) | 创建时间 |
Response Syntax
200 Response
Content-Type: application/json
{
"logId": 0,
"consumerId": 0,
"deviceKey": "string",
"optType": 0,
"optTitle": "string",
"reqBody": "string",
"resBody": "string",
"isAsync": 0,
"resCode": 0,
"resMessage": "string",
"createdAt": "string"
}| 名称 | 类型 | 说明 |
|---|---|---|
| logId | integer(int64) | 自增ID |
| consumerId | integer(int64) | 操作用户 |
| deviceKey | string(string) | 设备标识 |
| optType | integer(uint) | 类型;100:功能调用,101:分组功能调用,102:属性设置,103:分组属性设置,104:属性采集 |
| optTitle | string(string) | 消息标题 |
| reqBody | string(string) | 请求数据 |
| resBody | string(string) | 响应数据 |
| isAsync | integer(int) | 是否异步 |
| resCode | integer(int) | 响应码 |
| resMessage | string(string) | 响应描述 |
| createdAt | string(*gtime.Time) | 创建时间 |
消息回调(Message Callback)
关于第三方回调地址的说明
当平台产生特定事件(如设备状态变化、告警触发、任务完成等)时,会主动向用户配置的回调地址(Callback URL)发送通知。用户系统可通过接收并解析该通知,实现事件的实时处理。
作用
实时获取平台推送的事件信息,减少轮询请求,降低接口调用频率,支持自定义业务逻辑(如自动更新状态、触发告警处理等)
触发时机
例如:设备上线/离线
设备属性变化
告警触发与解除
任务执行结果返回
请求方式
HTTP Method:POST
Content-Type:application/json重试机制:发送失败会按一定策略重试(可配置)
回调数据
回调数据示例-设备上线回调
{
"msgType": "device_up", // 消息类型 "device_up":设备上下线或设备属性消息
"timestamp": "<timestamp>",
"data": {
"method": "thing.online.event", // 系统消息-上线
"tenantId": "1",
"projectId": 2001,
"productKey": "123",
"deviceKey": "dev_xyz456",
"msgId": "b7e2c1d0a8f14e2b9c3f1a2d4e5f6b7c", // uuid32.S()
"time": 1692182400000, // 时间戳毫秒
},
"sign": "<signature>"
}回调数据示例-设备下线回调
{
"msgType": "device_up", // 消息类型 "device_up":设备上下线或设备属性消息
"timestamp": "<timestamp>",
"data": {
"method": "thing.offline.event", // 系统消息-下线
"tenantId": "1",
"projectId": 2001,
"productKey": "prod_abc123",
"deviceKey": "dev_xyz456",
"msgId": "b7e2c1d0a8f14e2b9c3f1a2d4e5f6b7c", // uuid32.S()
"time": 1692182400000, // 时间戳毫秒
},
"sign": "<signature>"
}回调数据示例-属性上报回调
{
"msgType": "device_up", // 消息类型 "device_up":设备上下线或设备属性消息
"timestamp": "<timestamp>",
"data": {
"method": "thing.property.post",
"tenantId": "tenant_001",
"productKey": "prod_abc123",
"deviceKey": "dev_xyz456",
"msgId": "b7e2c1d0a8f14e2b9c3f1a2d4e5f6b7c", // uuid32.S()
"time": 1692182400000, // 时间戳毫秒
"propertys": {
"propertyKey": {
"Value": 25.5,
"Time": 1692182400000,
"Type": "float"
},
}
},
"sign": "<signature>"
}回调数据示例-事件上报回调
{
"msgType": "device_alarm", // 消息类型 "device_alarm":设备告警消息
"timestamp": "<timestamp>",
"data": {
"alarmLogId" : 123456, //报警记录ID
"alarmConfigId" : 7890, //报警配置ID
"sceneId" : 1001, //场景ID
"productKey": "prod_abc123", // 产品标识
"deviceKey": "dev_xyz456", // 设备标识
"title": "温度超限告警", // 报警标题
"alarmLevel": 2, // 报警级别(1=提醒通知 2=轻微问题 3=验证警告)
"startTime": 1692182400000, // 开始时间
"sceneConditions": "{\"temperature\":{\"gt\":30}}", // 场景条件JSON
"tenantId": "tenant_001", // 租户ID(报警配置所属租户)
"deptId": 200, // 所属机构
"projectId" : 2001 // 项目ID
},
"sign": "<signature>"
}开发者须知
回调地址需公网可访问,支持 HTTPS 优先,建议对回调内容进行签名验证,确保来源可靠。
请记录并处理回调日志,避免重复处理同一事件。
产品管理
读取产品信息
读取产品信息
Request Syntax
GET /api/v1/product/info
Content-Type: application/json
Authorization: Bearer < AccessToken >Query Parameters
| 名称 | 类型 | 说明 |
|---|---|---|
| productKey | string(string) | 产品标识 |
Response Syntax
200 Response
Content-Type: application/json
{
"productKey": "string",
"productName": "string",
"productAlias": "string",
"categoryId": 0,
"deviceType": 0,
"firmwareType": 0,
"networkType": 0,
"transport": 0,
"channelType": 0,
"imgUrl": "string",
"onlineTimeout": 0,
"deviceModel": "string",
"createdAt": "string",
"updatedBy": 0,
"updatedAt": "string",
"remark": "string",
"tsl": {
"key": "string",
"name": "string",
"properties": [
{
"key": "string",
"name": "string",
"order": 0,
"desc": "string",
"extFlag": {
"isChart": 0,
"isMonitor": 0,
"isReadonly": 0,
"isHistory": 0,
"isSharePerm": 0
},
"valueType": {
"type": "string",
"max": 0,
"min": 0,
"decimals": 0,
"unit": "string",
"step": 0,
"trueText": "string",
"falseText": "string",
"maxLength": 0,
"invalidAction": 0,
"fromType": "string",
"formula": "string",
"defaultValue": "string",
"enumList": [
null
],
"itemType": "string",
"arrayCount": 0,
"itemKeys": [
null
],
"items": [
null
]
},
"mapping": {
"type": "string",
"key": "string"
}
}
],
"functions": [
{
"key": "string",
"name": "string",
"order": 0,
"inputs": [
{
"key": null,
"name": null,
"order": null,
"desc": null,
"extFlag": null,
"valueType": null,
"mapping": null
}
],
"outputs": [
{
"key": null,
"name": null,
"order": null,
"desc": null,
"extFlag": null,
"valueType": null,
"mapping": null
}
],
"desc": "string",
"extFlag": {
"isHistory": 0,
"isSharePerm": 0
}
}
],
"events": [
{
"key": "string",
"name": "string",
"order": 0,
"inputs": [
{
"key": null,
"name": null,
"order": null,
"desc": null,
"extFlag": null,
"valueType": null,
"mapping": null
}
],
"desc": "string",
"extFlag": {
"isHistory": 0,
"isSharePerm": 0
}
}
],
"tags": [
{
"key": "string",
"name": "string",
"order": 0,
"desc": "string",
"extFlag": {
"isChart": 0,
"isMonitor": 0,
"isReadonly": 0,
"isHistory": 0,
"isSharePerm": 0
},
"valueType": {
"type": "string",
"max": 0,
"min": 0,
"decimals": 0,
"unit": "string",
"step": 0,
"trueText": "string",
"falseText": "string",
"maxLength": 0,
"invalidAction": 0,
"fromType": "string",
"formula": "string",
"defaultValue": "string",
"enumList": [
null
],
"itemType": "string",
"arrayCount": 0,
"itemKeys": [
null
],
"items": [
null
]
},
"mapping": {
"type": "string",
"key": "string"
}
}
],
"extConfig": {
"gpsConfig": {
"latAndLongKey": "string",
"latitudeKey": "string",
"longitudeKey": "string"
},
"simCardConfig": {
"iccidKey": "string",
"imsiKey": "string"
},
"tsdbConfig": {
"storePolicy": 0
},
"tagsConfig": {
"property1": "string",
"property2": "string"
}
}
}
}| 名称 | 类型 | 说明 |
|---|---|---|
| productKey | string(string) | 产品标识 |
| productName | string(string) | 产品名称 |
| productAlias | string(string) | 产品别名 |
| categoryId | integer(int64) | 产品分类ID |
| deviceType | integer(int) | 设备类型(1-直连设备、2-网关设备、3-子设备、4-监控设备) |
| firmwareType | integer(int) | 固件类型(1-分包、2-http) |
| networkType | integer(int) | 连网方式(1-以太网、2-蜂窝、3-WIFI、4-NB、5-其他) |
| transport | integer(int) | 通讯协议(1-内置MQTT协议、2-ModbusRTU、3-GB28181) |
| channelType | integer(int) | 通道类型(1-MQTT服务器、2-TCP服务器、3-UDP服务器、4-HTTP服务、5-WebSocket服务、6-数据库服务、7-GB28181) |
| imgUrl | string(string) | 图片地址 |
| onlineTimeout | integer(int) | 设备在线超时设置,单位:秒 |
| deviceModel | string(string) | 设备默认型号 |
| createdAt | string(*gtime.Time) | 创建时间 |
| updatedBy | integer(int64) | 更新者 |
| updatedAt | string(*gtime.Time) | 更新时间 |
| remark | string(string) | 备注 |
| tsl | [git.xiujie.cn.jieiot.jie-public.pkg.iotmodel.tsl.TSL] | 物模型 |
读取产品列表
读取产品列表
Request Syntax
GET /api/v1/product/list
Content-Type: application/json
Authorization: Bearer < AccessToken >Query Parameters
| 名称 | 类型 | 说明 |
|---|---|---|
| page | integer(int) | none |
| pageSize | integer(int) | none |
Response Syntax
200 Response
Content-Type: application/json
{
"list": [
{
"productKey": "string",
"productName": "string",
"productAlias": "string",
"categoryId": 0,
"deviceType": 0,
"firmwareType": 0,
"networkType": 0,
"transport": 0,
"channelType": 0,
"imgUrl": "string",
"onlineTimeout": 0,
"deviceModel": "string",
"createdAt": "string",
"updatedBy": 0,
"updatedAt": "string",
"remark": "string"
}
],
"total": 0
}| 名称 | 类型 | 说明 |
|---|---|---|
| productKey | string(string) | 产品标识 |
| productName | string(string) | 产品名称 |
| productAlias | string(string) | 产品别名 |
| categoryId | integer(int64) | 产品分类ID |
| deviceType | integer(int) | 设备类型(1-直连设备、2-网关设备、3-子设备、4-监控设备) |
| firmwareType | integer(int) | 固件类型(1-分包、2-http) |
| networkType | integer(int) | 连网方式(1-以太网、2-蜂窝、3-WIFI、4-NB、5-其他) |
| transport | integer(int) | 通讯协议(1-内置MQTT协议、2-ModbusRTU、3-GB28181) |
| channelType | integer(int) | 通道类型(1-MQTT服务器、2-TCP服务器、3-UDP服务器、4-HTTP服务、5-WebSocket服务、6-数据库服务、7-GB28181) |
| imgUrl | string(string) | 图片地址 |
| onlineTimeout | integer(int) | 设备在线超时设置,单位:秒 |
| deviceModel | string(string) | 设备默认型号 |
| createdAt | string(*gtime.Time) | 创建时间 |
| updatedBy | integer(int64) | 更新者 |
| updatedAt | string(*gtime.Time) | 更新时间 |
| remark | string(string) | 备注 |
服务信息
读取服务信息
读取平台服务的信息
Request Syntax
GET /api/v1/info
Content-Type: application/json
Authorization: Bearer < AccessToken >Response Syntax
200 Response
Content-Type: application/json
{
"type": "string",
"name": "string",
"title": "string",
"description": "string",
"version": "string",
"build": "string",
"commit": "string"
}| 名称 | 类型 | 说明 |
|---|---|---|
| type | string(string) | none |
| name | string(string) | none |
| title | string(string) | none |
| description | string(string) | none |
| version | string(string) | none |
| build | string(string) | none |
| commit | string(string) | none |




