dgiot/apps/dgiot_tdengine/priv/swagger/swagger_tdengine.json
2024-09-02 16:54:13 +08:00

444 lines
12 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"tags": [],
"definitions": {
},
"paths": {
"/product/{pid}": {
"get": {
"summary": "获取当前产品下的所有设备数据",
"description": "获取当前产品下的所有设备数据,支持聚合函数,选择函数,计算函数,时间维度聚合",
"parameters": [
{
"in": "path",
"name": "pid",
"required": true,
"description": "产品ID",
"type": "string",
"default": "0765bee775"
},
{
"in": "query",
"name": "order",
"description": "排序方式, 负为降序, eg: score,-name",
"required": false,
"type": "string",
"default": "createdat"
},
{
"in": "query",
"name": "limit",
"description": "limit, 显示多少条记录显示100条记录 eg:100",
"required": false,
"default": 10,
"type": "integer"
},
{
"in": "query",
"name": "skip",
"description": "skip",
"required": false,
"default": 0,
"type": "integer"
},
{
"in": "query",
"name": "keys",
"description": "需要显示的字段,加count(*)则结果里面会显示总记录数, last_row为获取最后一条记录, tbname,为设备字段, eg: username,email",
"required": false,
"type": "string",
"default": "last_row(*)"
},
{
"in": "query",
"name": "where",
"description": "过滤条件eg: {\"createdat\": {\"$gte\":\"now - 10d\"}}",
"required": false,
"type": "string",
"default": {
"createdat": {
"$gte": "now - 10d"
}
}
},
{
"in": "query",
"name": "fill",
"description": "填充模式,{ VALUE | PREV | NULL | LINEAR}",
"required": false,
"type": "string",
"default": "PREV"
},
{
"in": "query",
"name": "interval",
"description": "聚合时间段: 10a",
"required": false,
"type": "string",
"default": "10a"
},
{
"in": "query",
"name": "group",
"description": "聚合字段eg: devaddr",
"required": false,
"type": "string",
"default": "devaddr"
}
],
"responses": {
"200": {
"description": "Returns operation status"
},
"400": {
"description": "Bad Request"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"500": {
"description": "Server Internal error"
}
},
"tags": [
"Basic"
]
}
},
"/device/{deviceid}": {
"get": {
"summary": "获取当前设备时序数据",
"description": "获取当前设备数据,支持聚合函数,选择函数,计算函数,时间维度聚合",
"parameters": [
{
"in": "path",
"name": "deviceid",
"required": true,
"description": "设备ID",
"type": "string"
},
{
"in": "query",
"name": "order",
"description": "排序方式, 负为降序, eg: score,-name",
"required": false,
"type": "string",
"default": "createdAt"
},
{
"in": "query",
"name": "limit",
"description": "limit, 显示多少条记录显示100条记录 eg:100",
"required": false,
"default": 10,
"type": "integer"
},
{
"in": "query",
"name": "skip",
"description": "skip",
"required": false,
"default": 0,
"type": "integer"
},
{
"in": "query",
"name": "keys",
"description": "需要显示的字段,加count(*)则结果里面会显示总记录数, last_row为获取最后一条记录, eg: username,email",
"required": false,
"default": "",
"type": "string"
},
{
"in": "query",
"name": "where",
"description": "过滤条件eg: {\"createdat\": {\"$gte\":\"now - 10d\"}}",
"default": "{\"createdat\":{\"$gte\":\"now - 10d\"}}",
"required": false,
"type": "string"
}
],
"responses": {
"200": {
"description": "Returns operation status"
},
"400": {
"description": "Bad Request"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"500": {
"description": "Server Internal error"
}
},
"tags": [
"Basic"
]
}
},
"/echart/{deviceid}": {
"get": {
"summary": "获取当前设备时序数据图表",
"description": "获取当前设备数据图表,支持折线图,柱状图,饼图等",
"parameters": [
{
"in": "query",
"name": "style",
"description": "图标类型",
"default": "line",
"required": true,
"type": "string",
"enum": [
"amis_table",
"line",
"echart_category"
]
},
{
"in": "query",
"name": "month_count",
"description": "月份数量",
"default": "1",
"required": false,
"type": "number"
},
{
"in": "path",
"name": "deviceid",
"required": true,
"default": "a90437ec84",
"description": "设备ID",
"type": "string"
},
{
"in": "query",
"name": "starttime",
"description": "开始时间(时间戳毫秒)",
"default": "1610091977000",
"required": false,
"type": "string"
},
{
"in": "query",
"name": "endtime",
"description": "结束时间(时间戳毫秒)",
"default": "1623138377000",
"required": false,
"type": "string"
},
{
"in": "query",
"name": "interval",
"description": "统计间隔",
"enum": [
"1u",
"1a",
"1s",
"1m",
"1h",
"1d",
"1w",
"1n",
"1y"
],
"default": "1m",
"required": false,
"type": "string"
},
{
"in": "query",
"name": "keys",
"description": "需要显示的字段,加 * 则结果显示物模型所有字段",
"required": false,
"default": "*",
"type": "string"
},
{
"in": "query",
"name": "limit",
"description": "limit, 显示多少条记录显示100条记录 eg:100",
"required": false,
"default": 10,
"type": "integer"
},
{
"in": "query",
"name": "function",
"description": "聚合/计算函数",
"enum": [
"count",
"avg",
"sum",
"stddev",
"min",
"max",
"first",
"last"
],
"default": "last",
"required": false,
"type": "string"
}
],
"responses": {
"200": {
"description": "Returns operation status"
},
"400": {
"description": "Bad Request"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"500": {
"description": "Server Internal error"
}
},
"tags": [
"View"
]
}
},
"/devicecard/{deviceid}": {
"get": {
"summary": "获取当前设备最新时序数据卡片",
"description": "获取当前设备最新时序数据卡片",
"parameters": [
{
"in": "path",
"name": "deviceid",
"required": true,
"default": "a90437ec84",
"description": "设备ID",
"type": "string"
},
{
"in": "query",
"name": "keys",
"description": "需要显示的字段, eg: username,email",
"required": false,
"type": "string"
}
],
"responses": {
"200": {
"description": "Returns operation status"
},
"400": {
"description": "Bad Request"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"500": {
"description": "Server Internal error"
}
},
"tags": [
"View"
]
}
},
"/gps/track/{deviceid}": {
"get": {
"summary": "获取当前设备gps轨迹",
"description": "获取当前设备gps轨迹",
"parameters": [
{
"in": "path",
"name": "deviceid",
"default": "a90437ec84",
"description": "设备ID",
"type": "string"
}
],
"responses": {
"200": {
"description": "Returns operation status"
},
"400": {
"description": "Bad Request"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"500": {
"description": "Server Internal error"
}
},
"tags": [
"View"
]
}
},
"/save_td": {
"post": {
"description": "存td",
"parameters": [
{
"description": "存储数据到td",
"in": "body",
"name": "data",
"required": true,
"schema": {
"properties": {
"productid": {
"description": "产品id",
"type": "string",
"required": true,
"example": ""
},
"devaddr": {
"description": "设备地址",
"type": "string",
"required": true,
"example": ""
},
"data": {
"description": "存储数据",
"type": "object",
"required": true,
"example": {}
}
}
}
}
],
"responses": {
"200": {
"description": "Returns operation status"
},
"400": {
"description": "Bad Request"
},
"403": {
"description": "Forbidden"
},
"500": {
"description": "Server Internal error"
}
},
"summary": "存储数据到td",
"tags": [
"Basic"
]
}
}
}
}