From b8ca369513ae4076910a9f0095f495aa271bb83e Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 12 Apr 2023 19:20:16 +0800 Subject: [PATCH 1/3] docs: add rest api diff (#20892) --- .../14-reference/02-rest-api/02-rest-api.mdx | 94 ++++++++++++++++++ docs/zh/08-connector/02-rest-api.mdx | 97 +++++++++++++++++++ 2 files changed, 191 insertions(+) diff --git a/docs/en/14-reference/02-rest-api/02-rest-api.mdx b/docs/en/14-reference/02-rest-api/02-rest-api.mdx index 1691b8be8b..115391d021 100644 --- a/docs/en/14-reference/02-rest-api/02-rest-api.mdx +++ b/docs/en/14-reference/02-rest-api/02-rest-api.mdx @@ -382,6 +382,100 @@ Response body: } ``` +## REST API between TDengine 2.x and 3.0 + +### URI + +| URI | TDengine 2.x | TDengine 3.0 | +| :--------------------| :------------------: | :--------------------------------------------------: | +| /rest/sql | Supported | Supported (with different response code and body) | +| /rest/sqlt | Supported | No more supported | +| /rest/sqlutc | Supported | No more supported | + +### HTTP code + +| HTTP code | TDengine 2.x | TDengine 3.0 | note | +| :--------------------| :------------------: | :----------: | :-----------------------------------: | +| 200 | Supported | Supported | Success or taosc return error | +| 400 | Not supported | Supported | Parameter error | +| 401 | Not supported | Supported | Authentication failure | +| 404 | Supported | Supported | URI not exist | +| 500 | Not supported | Supported | Internal error | +| 503 | Supported | Supported | Insufficient system resources | + +### Response body + +| Response body | TDengine 2.x | TDengine 3.0 | note | +| :--------------------| :------------------: | :----------: | :-----------------------------------: | +| Success | "status": "succ", | "code": 0, | | +| Column meta | "head": [ + "name", + "created_time", + "ntables", + "vgroups", + "replica", + "quorum", + "days", + "keep1,keep2,keep(D)", + "cache(MB)", + "blocks", + "minrows", + "maxrows", + "wallevel", + "fsync", + "comp", + "precision", + "status" + ], | "column_meta": [ + [ + "name", + "VARCHAR", + 64 + ], + [ + "ntables", + "BIGINT", + 8 + ], + [ + "status", + "VARCHAR", + 10 + ] + ], | | +| Data | "data": [ + [ + "log", + "2020-09-02 17:23:00.039", + 4, + 1, + 1, + 1, + 10, + "30,30,30", + 1, + 3, + 100, + 4096, + 1, + 3000, + 2, + "us", + "ready" + ] + ], | "data": [ + [ + "information_schema", + 16, + "ready" + ], + [ + "performance_schema", + 9, + "ready" + ] + ], | | + ## Reference [taosAdapter](/reference/taosadapter/) diff --git a/docs/zh/08-connector/02-rest-api.mdx b/docs/zh/08-connector/02-rest-api.mdx index a081595bca..ece8eb0acd 100644 --- a/docs/zh/08-connector/02-rest-api.mdx +++ b/docs/zh/08-connector/02-rest-api.mdx @@ -383,6 +383,103 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata } ``` +## TDengine 2.x 和 3.0 之间 REST API 的差异 + +### URI + +| URI | TDengine 2.x | TDengine 3.0 | +| :--------------------| :------------------: | :--------------------------------------------------: | +| /rest/sql | 支持 | 支持 (响应代码和消息体不同) | +| /rest/sqlt | 支持 | 不再支持 | +| /rest/sqlutc | 支持 | 不再支持 | + + +### HTTP code + +| HTTP code | TDengine 2.x | TDengine 3.0 | 备注 | +| :--------------------| :------------------: | :----------: | :-----------------------------------: | +| 200 | 支持 | 支持 | 正确返回和 taosc 接口错误返回 | +| 400 | 不支持 | 支持 | 参数错误返回 | +| 401 | 不支持 | 支持 | 鉴权失败 | +| 404 | 支持 | 支持 | 接口不存在 | +| 500 | 不支持 | 支持 | 内部错误 | +| 503 | 支持 | 支持 | 系统资源不足 | + + +### 响应代码和消息体 + +| 响应代码和消息体 | TDengine 2.x | TDengine 3.0 | note | +| :--------------------| :------------------: | :----------: | :-----------------------------------: | +| Success | "status": "succ", | "code": 0, | | +| Column meta | "head": [ + "name", + "created_time", + "ntables", + "vgroups", + "replica", + "quorum", + "days", + "keep1,keep2,keep(D)", + "cache(MB)", + "blocks", + "minrows", + "maxrows", + "wallevel", + "fsync", + "comp", + "precision", + "status" + ], | "column_meta": [ + [ + "name", + "VARCHAR", + 64 + ], + [ + "ntables", + "BIGINT", + 8 + ], + [ + "status", + "VARCHAR", + 10 + ] + ], | | +| Data | "data": [ + [ + "log", + "2020-09-02 17:23:00.039", + 4, + 1, + 1, + 1, + 10, + "30,30,30", + 1, + 3, + 100, + 4096, + 1, + 3000, + 2, + "us", + "ready" + ] + ], | "data": [ + [ + "information_schema", + 16, + "ready" + ], + [ + "performance_schema", + 9, + "ready" + ] + ], | | + + ## 参考 [taosAdapter](/reference/taosadapter/) From c3abf5ede772d01d295c75d7932a1b255235bb21 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 12 Apr 2023 19:51:37 +0800 Subject: [PATCH 2/3] docs: use html table in rest api (#20893) * docs: add rest api diff * docs: use html table --- .../14-reference/02-rest-api/02-rest-api.mdx | 49 ++++++++++++++---- docs/zh/08-connector/02-rest-api.mdx | 50 +++++++++++++++---- 2 files changed, 80 insertions(+), 19 deletions(-) diff --git a/docs/en/14-reference/02-rest-api/02-rest-api.mdx b/docs/en/14-reference/02-rest-api/02-rest-api.mdx index 115391d021..01d1a9b12b 100644 --- a/docs/en/14-reference/02-rest-api/02-rest-api.mdx +++ b/docs/en/14-reference/02-rest-api/02-rest-api.mdx @@ -405,10 +405,18 @@ Response body: ### Response body -| Response body | TDengine 2.x | TDengine 3.0 | note | -| :--------------------| :------------------: | :----------: | :-----------------------------------: | -| Success | "status": "succ", | "code": 0, | | -| Column meta | "head": [ + + + + + + +/ + + + + + + + + + + +
Response body TDengine 2.x TDengine 3.0
Success "status": "succ", "code": 0,
Column meta +``` +"head": [ "name", "created_time", "ntables", @@ -426,7 +434,12 @@ Response body: "comp", "precision", "status" - ], | "column_meta": [ + ], +``` + +``` +"column_meta": [ [ "name", "VARCHAR", @@ -442,8 +455,17 @@ Response body: "VARCHAR", 10 ] - ], | | -| Data | "data": [ + ], +``` +
+Data + +``` +"data": [ [ "log", "2020-09-02 17:23:00.039", @@ -463,7 +485,12 @@ Response body: "us", "ready" ] - ], | "data": [ + ], +``` + +``` + "data": [ [ "information_schema", 16, @@ -474,7 +501,11 @@ Response body: 9, "ready" ] - ], | | + ], +``` +
## Reference diff --git a/docs/zh/08-connector/02-rest-api.mdx b/docs/zh/08-connector/02-rest-api.mdx index ece8eb0acd..ae0949c4fd 100644 --- a/docs/zh/08-connector/02-rest-api.mdx +++ b/docs/zh/08-connector/02-rest-api.mdx @@ -408,10 +408,18 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata ### 响应代码和消息体 -| 响应代码和消息体 | TDengine 2.x | TDengine 3.0 | note | -| :--------------------| :------------------: | :----------: | :-----------------------------------: | -| Success | "status": "succ", | "code": 0, | | -| Column meta | "head": [ + + + + + + +/ + + + + + + + + + + +
响应代码和消息体 TDengine 2.x TDengine 3.0
Success "status": "succ", "code": 0,
Column meta +``` +"head": [ "name", "created_time", "ntables", @@ -429,7 +437,12 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata "comp", "precision", "status" - ], | "column_meta": [ + ], +``` + +``` +"column_meta": [ [ "name", "VARCHAR", @@ -445,8 +458,17 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata "VARCHAR", 10 ] - ], | | -| Data | "data": [ + ], +``` +
+Data + +``` +"data": [ [ "log", "2020-09-02 17:23:00.039", @@ -466,7 +488,12 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata "us", "ready" ] - ], | "data": [ + ], +``` + +``` + "data": [ [ "information_schema", 16, @@ -477,8 +504,11 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata 9, "ready" ] - ], | | - + ], +``` +
## 参考 From c1412648d05f09fe4b600e9064312ab9390d781a Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 12 Apr 2023 21:46:19 +0800 Subject: [PATCH 3/3] docs: use json instead of table in rest api (#20895) * docs: add rest api diff * docs: use html table * docs: use json instead of table in rest api doc --- .../14-reference/02-rest-api/02-rest-api.mdx | 97 +++++++++--------- docs/zh/08-connector/02-rest-api.mdx | 98 +++++++++---------- 2 files changed, 97 insertions(+), 98 deletions(-) diff --git a/docs/en/14-reference/02-rest-api/02-rest-api.mdx b/docs/en/14-reference/02-rest-api/02-rest-api.mdx index 01d1a9b12b..409e079b92 100644 --- a/docs/en/14-reference/02-rest-api/02-rest-api.mdx +++ b/docs/en/14-reference/02-rest-api/02-rest-api.mdx @@ -405,18 +405,12 @@ Response body: ### Response body - - - - - - -/ - - - - - - - - - - -
Response body TDengine 2.x TDengine 3.0
Success "status": "succ", "code": 0,
Column meta -``` -"head": [ +#### REST response body return from TDengine 2.x + +```JSON +{ + "status": "succ", + "head": [ "name", "created_time", "ntables", @@ -435,37 +429,7 @@ Response body: "precision", "status" ], -``` - -``` -"column_meta": [ - [ - "name", - "VARCHAR", - 64 - ], - [ - "ntables", - "BIGINT", - 8 - ], - [ - "status", - "VARCHAR", - 10 - ] - ], -``` -
-Data - -``` -"data": [ + "data": [ [ "log", "2020-09-02 17:23:00.039", @@ -485,10 +449,10 @@ Data "us", "ready" ] - ], + ], + "rows": 1 +} ``` - ``` "data": [ [ @@ -503,9 +467,44 @@ Data ] ], ``` -
+ +#### REST response body return from TDengine 3.0 + +```JSON +{ + "code": 0, + "column_meta": [ + [ + "name", + "VARCHAR", + 64 + ], + [ + "ntables", + "BIGINT", + 8 + ], + [ + "status", + "VARCHAR", + 10 + ] + ], + "data": [ + [ + "information_schema", + 16, + "ready" + ], + [ + "performance_schema", + 9, + "ready" + ] + ], + "rows": 2 +} +``` ## Reference diff --git a/docs/zh/08-connector/02-rest-api.mdx b/docs/zh/08-connector/02-rest-api.mdx index ae0949c4fd..f3f1e087d8 100644 --- a/docs/zh/08-connector/02-rest-api.mdx +++ b/docs/zh/08-connector/02-rest-api.mdx @@ -408,18 +408,12 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata ### 响应代码和消息体 - - - - - - -/ - - - - - - - - - - -
响应代码和消息体 TDengine 2.x TDengine 3.0
Success "status": "succ", "code": 0,
Column meta -``` -"head": [ +#### TDengine 2.x 响应代码和消息体 + +```JSON +{ + "status": "succ", + "head": [ "name", "created_time", "ntables", @@ -438,37 +432,7 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata "precision", "status" ], -``` - -``` -"column_meta": [ - [ - "name", - "VARCHAR", - 64 - ], - [ - "ntables", - "BIGINT", - 8 - ], - [ - "status", - "VARCHAR", - 10 - ] - ], -``` -
-Data - -``` -"data": [ + "data": [ [ "log", "2020-09-02 17:23:00.039", @@ -488,10 +452,10 @@ Data "us", "ready" ] - ], + ], + "rows": 1 +} ``` - ``` "data": [ [ @@ -506,9 +470,45 @@ Data ] ], ``` -
+ +#### TDengine 3.0 响应代码和消息体 + + +```JSON +{ + "code": 0, + "column_meta": [ + [ + "name", + "VARCHAR", + 64 + ], + [ + "ntables", + "BIGINT", + 8 + ], + [ + "status", + "VARCHAR", + 10 + ] + ], + "data": [ + [ + "information_schema", + 16, + "ready" + ], + [ + "performance_schema", + 9, + "ready" + ] + ], + "rows": 2 +} +``` ## 参考