This is an automated email from the ASF dual-hosted git repository. haonan pushed a commit to branch rename_rest_header in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 2e3749b1684480bcfbb33270e278e1c6efde95db Author: HTHou <[email protected]> AuthorDate: Wed Nov 23 17:20:13 2022 +0800 Unify Column Header in RestApi --- docs/UserGuide/API/RestService.md | 60 +++++++++--------- docs/UserGuide/Write-Data/REST-API.md | 6 +- docs/zh/UserGuide/API/RestService.md | 74 +++++++++++----------- docs/zh/UserGuide/Write-Data/REST-API.md | 6 +- grafana-plugin/go.mod | 4 +- grafana-plugin/go.sum | 36 +++++++++-- openapi/src/main/openapi3/iotdb-rest.yaml | 17 ++--- .../iotdb/db/conf/rest/IoTDBRestServiceConfig.java | 2 +- .../rest/handler/RequestValidationHandler.java | 14 ++-- .../rest/handler/StatementConstructionHandler.java | 2 +- 10 files changed, 125 insertions(+), 96 deletions(-) diff --git a/docs/UserGuide/API/RestService.md b/docs/UserGuide/API/RestService.md index 2f1188a6f1..9717cb55a3 100644 --- a/docs/UserGuide/API/RestService.md +++ b/docs/UserGuide/API/RestService.md @@ -138,16 +138,16 @@ Request path: http://ip:port/rest/v1/query Parameter Description: | parameter name | parameter type | required | parameter description | -| -------------- | -------------- | -------- | ------------------------------------------------------------ | +|----------------| -------------- | -------- | ------------------------------------------------------------ | | sql | string | yes | | -| rowLimit | integer | no | The maximum number of rows in the result set that can be returned by a query. <br />If this parameter is not set, the `rest_query_default_row_size_limit` of the configuration file will be used as the default value. <br /> When the number of rows in the returned result set exceeds the limit, the status code `411` will be returned. | +| row_limit | integer | no | The maximum number of rows in the result set that can be returned by a query. <br />If this parameter is not set, the `rest_query_default_row_size_limit` of the configuration file will be used as the default value. <br /> When the number of rows in the returned result set exceeds the limit, the status code `411` will be returned. | Response parameters: | parameter name | parameter type | parameter description | -| -------------- | -------------- | ------------------------------------------------------------ | +|----------------| -------------- | ------------------------------------------------------------ | | expressions | array | Array of result set column names for data query, `null` for metadata query | -| columnNames | array | Array of column names for metadata query result set, `null` for data query | +| column_names | array | Array of column names for metadata query result set, `null` for data query | | timestamps | array | Timestamp column, `null` for metadata query | | values | array | A two-dimensional array, the first dimension has the same length as the result set column name array, and the second dimension array represents a column of the result set | @@ -168,7 +168,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "root.sg27.s4", "root.sg27.s3 + 1" ], - "columnNames": null, + "column_names": null, "timestamps": [ 1635232143960, 1635232153960 @@ -199,7 +199,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "child paths" ], "timestamps": null, @@ -221,7 +221,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "child nodes" ], "timestamps": null, @@ -243,7 +243,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "database", "ttl" ], @@ -270,7 +270,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "database", "ttl" ], @@ -295,7 +295,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "function name", "function type", "class name (UDF)" @@ -333,7 +333,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "timeseries", "alias", "database", @@ -406,7 +406,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "timeseries", "alias", "database", @@ -479,7 +479,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "count" ], "timestamps": null, @@ -500,7 +500,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "count" ], "timestamps": null, @@ -521,7 +521,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "devices", "isAligned" ], @@ -548,7 +548,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "devices", "database", "isAligned" @@ -580,7 +580,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "user" ], "timestamps": null, @@ -604,7 +604,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "count(root.sg27.s3)", "count(root.sg27.s4)" ], - "columnNames": null, + "column_names": null, "timestamps": [ 0 ], @@ -628,7 +628,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "count(root.sg27.*)", "count(root.sg28.*)" ], @@ -656,7 +656,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "count(root.sg27.s3)", "count(root.sg27.s4)" ], - "columnNames": null, + "column_names": null, "timestamps": [ 1635232143960, 1635232144960, @@ -707,7 +707,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" - ```json { "expressions": null, - "columnNames": [ + "column_names": [ "timeseries", "value", "dataType" @@ -814,18 +814,18 @@ Request path: http://ip:port/rest/v1/insertTablet Parameter Description: -|parameter name |parameter type |is required|parameter describe| -|:--- | :--- | :---| :---| -| timestamps | array | yes | Time column | -| measurements | array | yes | The name of the measuring point | -| dataTypes | array | yes | The data type | -| values | array | yes | Value columns, the values in each column can be `null` | -| isAligned | boolean | yes | Whether to align the timeseries | -| deviceId | string | yes | Device name | +| parameter name |parameter type |is required|parameter describe| +|:---------------| :--- | :---| :---| +| timestamps | array | yes | Time column | +| measurements | array | yes | The name of the measuring point | +| data_types | array | yes | The data type | +| values | array | yes | Value columns, the values in each column can be `null` | +| is_aligned | boolean | yes | Whether to align the timeseries | +| device | string | yes | Device name | Example request: ```shell -curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X POST --data '{"timestamps":[1635232143960,1635232153960],"measurements":["s3","s4"],"dataTypes":["INT32","BOOLEAN"],"values":[[11,null],[false,true]],"isAligned":false,"deviceId":"root.sg27"}' http://127.0.0.1:18080/rest/v1/insertTablet +curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X POST --data '{"timestamps":[1635232143960,1635232153960],"measurements":["s3","s4"],"data_types":["INT32","BOOLEAN"],"values":[[11,null],[false,true]],"is_aligned":false,"device":"root.sg27"}' http://127.0.0.1:18080/rest/v1/insertTablet ``` Sample response: diff --git a/docs/UserGuide/Write-Data/REST-API.md b/docs/UserGuide/Write-Data/REST-API.md index a298905741..71927c3dc5 100644 --- a/docs/UserGuide/Write-Data/REST-API.md +++ b/docs/UserGuide/Write-Data/REST-API.md @@ -36,7 +36,7 @@ Example: "temperature", "status" ], - "dataTypes": [ + "data_types": [ "FLOAT", "BOOLEAN" ], @@ -52,7 +52,7 @@ Example: true ] ], - "isAligned": false, - "deviceId": "root.ln.wf01.wt01" + "is_aligned": false, + "device": "root.ln.wf01.wt01" } ``` \ No newline at end of file diff --git a/docs/zh/UserGuide/API/RestService.md b/docs/zh/UserGuide/API/RestService.md index ae80ecd7dd..5c9fac9ed1 100644 --- a/docs/zh/UserGuide/API/RestService.md +++ b/docs/zh/UserGuide/API/RestService.md @@ -131,19 +131,19 @@ query 接口可以用于处理数据查询和元数据查询。 参数说明: -|参数名称 |参数类型 |是否必填|参数描述| -| ------------ | ------------ | ------------ |------------ | -| sql | string | 是 | | -| rowLimit | integer | 否 | 一次查询能返回的结果集的最大行数。<br />如果不设置该参数,将使用配置文件的 `rest_query_default_row_size_limit` 作为默认值。<br />当返回结果集的行数超出限制时,将返回状态码 `411`。 | +| 参数名称 |参数类型 |是否必填|参数描述| +|-----------| ------------ | ------------ |------------ | +| sql | string | 是 | | +| row_limit | integer | 否 | 一次查询能返回的结果集的最大行数。<br />如果不设置该参数,将使用配置文件的 `rest_query_default_row_size_limit` 作为默认值。<br />当返回结果集的行数超出限制时,将返回状态码 `411`。 | 响应参数: -|参数名称 |参数类型 |参数描述| -| ------------ | ------------ | ------------| -| expressions | array | 用于数据查询时结果集列名的数组,用于元数据查询时为`null`| -| columnNames | array | 用于元数据查询结果集列名数组,用于数据查询时为`null` | -| timestamps | array | 时间戳列,用于元数据查询时为`null` | -|values|array|二维数组,第一维与结果集列名数组的长度相同,第二维数组代表结果集的一列| +| 参数名称 |参数类型 |参数描述| +|--------------| ------------ | ------------| +| expressions | array | 用于数据查询时结果集列名的数组,用于元数据查询时为`null`| +| column_names | array | 用于元数据查询结果集列名数组,用于数据查询时为`null` | +| timestamps | array | 时间戳列,用于元数据查询时为`null` | +| values |array|二维数组,第一维与结果集列名数组的长度相同,第二维数组代表结果集的一列| 请求示例如下所示: @@ -163,7 +163,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "root.sg27.s4", "root.sg27.s3 + 1" ], - "columnNames": null, + "column_names": null, "timestamps": [ 1635232143960, 1635232153960 @@ -195,7 +195,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "child paths" ], "timestamps": null, @@ -218,7 +218,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "child nodes" ], "timestamps": null, @@ -241,7 +241,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "database", "ttl" ], @@ -269,7 +269,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "database", "ttl" ], @@ -295,7 +295,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "function name", "function type", "class name (UDF)" @@ -306,7 +306,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "ABS", "ACOS", "ASIN", - ... + ... ], [ "built-in UDTF", @@ -334,7 +334,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "timeseries", "alias", "database", @@ -408,7 +408,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "timeseries", "alias", "database", @@ -482,7 +482,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "count" ], "timestamps": null, @@ -504,7 +504,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "count" ], "timestamps": null, @@ -526,7 +526,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "devices", "isAligned" ], @@ -554,7 +554,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "devices", "database", "isAligned" @@ -587,7 +587,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "user" ], "timestamps": null, @@ -612,7 +612,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "count(root.sg27.s3)", "count(root.sg27.s4)" ], - "columnNames": null, + "column_names": null, "timestamps": [ 0 ], @@ -637,7 +637,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X ```json { "expressions": null, - "columnNames": [ + "column_names": [ "count(root.sg27.*)", "count(root.sg28.*)" ], @@ -666,7 +666,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X "count(root.sg27.s3)", "count(root.sg27.s4)" ], - "columnNames": null, + "column_names": null, "timestamps": [ 1635232143960, 1635232144960, @@ -718,7 +718,7 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" - ```json { "expressions": null, - "columnNames": [ + "column_names": [ "timeseries", "value", "dataType" @@ -828,18 +828,18 @@ curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X 参数说明: -|参数名称 |参数类型 |是否必填|参数描述| -| ------------ | ------------ | ------------ |------------ | -| timestamps | array | 是 | 时间列 | -| measurements | array | 是 | 测点名称 | -| dataTypes | array | 是 | 数据类型 | -| values | array | 是 | 值列,每一列中的值可以为 `null` | -| isAligned | boolean | 是 | 是否是对齐时间序列 | -| deviceId | string | 是 | 设备名称 | +| 参数名称 |参数类型 |是否必填|参数描述| +|--------------| ------------ | ------------ |------------ | +| timestamps | array | 是 | 时间列 | +| measurements | array | 是 | 测点名称 | +| data_types | array | 是 | 数据类型 | +| values | array | 是 | 值列,每一列中的值可以为 `null` | +| is_aligned | boolean | 是 | 是否是对齐时间序列 | +| device | string | 是 | 设备名称 | 请求示例: ```shell -curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X POST --data '{"timestamps":[1635232143960,1635232153960],"measurements":["s3","s4"],"dataTypes":["INT32","BOOLEAN"],"values":[[11,null],[false,true]],"isAligned":false,"deviceId":"root.sg27"}' http://127.0.0.1:18080/rest/v1/insertTablet +curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X POST --data '{"timestamps":[1635232143960,1635232153960],"measurements":["s3","s4"],"data_types":["INT32","BOOLEAN"],"values":[[11,null],[false,true]],"is_aligned":false,"device":"root.sg27"}' http://127.0.0.1:18080/rest/v1/insertTablet ``` 响应参数: diff --git a/docs/zh/UserGuide/Write-Data/REST-API.md b/docs/zh/UserGuide/Write-Data/REST-API.md index f53a7641c2..edcd552c95 100644 --- a/docs/zh/UserGuide/Write-Data/REST-API.md +++ b/docs/zh/UserGuide/Write-Data/REST-API.md @@ -35,7 +35,7 @@ "temperature", "status" ], - "dataTypes": [ + "data_types": [ "FLOAT", "BOOLEAN" ], @@ -51,7 +51,7 @@ true ] ], - "isAligned": false, - "deviceId": "root.ln.wf01.wt01" + "is_aligned": false, + "device": "root.ln.wf01.wt01" } ``` diff --git a/grafana-plugin/go.mod b/grafana-plugin/go.mod index e6d4a76021..fa2113ac02 100644 --- a/grafana-plugin/go.mod +++ b/grafana-plugin/go.mod @@ -18,6 +18,6 @@ module github.com/grafana/grafana-starter-datasource-backend go 1.16 require ( - github.com/grafana/grafana-plugin-sdk-go v0.139.0 - github.com/magefile/mage v1.13.0 // indirect + github.com/grafana/grafana-plugin-sdk-go v0.144.0 + github.com/magefile/mage v1.14.0 // indirect ) diff --git a/grafana-plugin/go.sum b/grafana-plugin/go.sum index 4dc5cdec48..2d01c214af 100644 --- a/grafana-plugin/go.sum +++ b/grafana-plugin/go.sum @@ -32,6 +32,7 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= @@ -65,6 +66,8 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -86,6 +89,8 @@ github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/getkin/kin-openapi v0.94.0 h1:bAxg2vxgnHHHoeefVdmGbR+oxtJlcv5HsJJa3qmAHuo= github.com/getkin/kin-openapi v0.94.0/go.mod h1:LWZfzOd7PRy8GJ1dJ6mCU6tNdSfOwRac1BUPam4aw6Q= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= @@ -175,10 +180,12 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1ks85zJ1lfDGgIiMDuIptTOhJq+zKyg= +github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/grafana/grafana-plugin-sdk-go v0.139.0 h1:2RQKM2QpSaWTtaGN6sK+R7LO7zykOeTYF0QkAMA7JsI= -github.com/grafana/grafana-plugin-sdk-go v0.139.0/go.mod h1:Y+Ps2sesZ62AyCnX+hzrYnyDQYe/ZZl+A8yKLOBm12c= +github.com/grafana/grafana-plugin-sdk-go v0.144.0 h1:NsuK9AKWeWBbuNREsF4hrLA3TnYPPpDJTqcPqm288aw= +github.com/grafana/grafana-plugin-sdk-go v0.144.0/go.mod h1:dFof/7GenWBFTmrfcPRCpLau7tgIED0ykzupWAlB0o0= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= @@ -206,6 +213,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE= +github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= @@ -222,9 +231,9 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/magefile/mage v1.12.1/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= -github.com/magefile/mage v1.13.0 h1:XtLJl8bcCM7EFoO8FyH8XK3t7G5hQAeK+i4tq+veT9M= github.com/magefile/mage v1.13.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= +github.com/magefile/mage v1.14.0 h1:6QDX3g6z1YvJ4olPhT1wksUcSa/V0a1B+pJb73fBjyo= +github.com/magefile/mage v1.14.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= @@ -296,10 +305,18 @@ github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1 github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 h1:Jpy1PXuP99tXNrhbq2BaPz9B+jNAvH1JPQQpG/9GCXY= +github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c h1:Ho+uVpkel/udgjbwB5Lktg9BtvJSh2DT0Hi6LPSyI2w= +github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -310,6 +327,14 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8 h1:aVGB3YnaS/JNfOW3tiHIlmNmTDg618va+eT0mVomgyI= +github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8/go.mod h1:fVle4kNr08ydeohzYafr20oZzbAkhQT39gKK/pFQ5M4= +github.com/unknwon/com v1.0.1 h1:3d1LTxD+Lnf3soQiD4Cp/0BRB+Rsa/+RTvz8GMMzIXs= +github.com/unknwon/com v1.0.1/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM= +github.com/unknwon/log v0.0.0-20150304194804-e617c87089d3 h1:4EYQaWAatQokdji3zqZloVIW/Ke1RQjYw2zHULyrHJg= +github.com/unknwon/log v0.0.0-20150304194804-e617c87089d3/go.mod h1:1xEUf2abjfP92w2GZTV+GgaRxXErwRXcClbUwrNJffU= +github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY= +github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -440,6 +465,7 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191020152052-9984515f0562/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -635,6 +661,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify/fsnotify.v1 v1.4.7 h1:XNNYLJHt73EyYiCZi6+xjupS9CpvmiDgjPTAjrBlQbo= +gopkg.in/fsnotify/fsnotify.v1 v1.4.7/go.mod h1:Fyux9zXlo4rWoMSIzpn9fDAYjalPqJ/K1qJ27s+7ltE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/openapi/src/main/openapi3/iotdb-rest.yaml b/openapi/src/main/openapi3/iotdb-rest.yaml index 8bdb9dc4e5..b9cd29ff2c 100644 --- a/openapi/src/main/openapi3/iotdb-rest.yaml +++ b/openapi/src/main/openapi3/iotdb-rest.yaml @@ -23,6 +23,7 @@ info: description: IoTDB Rest API for Grafana, Prometheus, etc.. license: name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html version: 1.0.0 servers: - url: http://127.0.0.1:18080/ @@ -173,7 +174,7 @@ components: properties: sql: type: string - rowLimit: + row_limit: type: integer format: int32 @@ -190,7 +191,7 @@ components: type: array items: type: string - dataTypes: + data_types: type: array items: type: string @@ -200,9 +201,9 @@ components: type: array items: type: object - isAligned: + is_aligned: type: boolean - deviceId: + device: type: string ExecutionStatus: @@ -221,7 +222,7 @@ components: type: array items: type: string - columnNames: + column_names: type: array items: type: string @@ -244,7 +245,7 @@ components: type: array items: type: string - prefixPath: + prefix_path: type: array items: type: string @@ -252,9 +253,9 @@ components: type: string control: type: string - startTime: + start_time: type: number - endTime: + end_time: type: number VariablesResult: diff --git a/server/src/main/java/org/apache/iotdb/db/conf/rest/IoTDBRestServiceConfig.java b/server/src/main/java/org/apache/iotdb/db/conf/rest/IoTDBRestServiceConfig.java index eb4af414c6..6e29fd55a3 100644 --- a/server/src/main/java/org/apache/iotdb/db/conf/rest/IoTDBRestServiceConfig.java +++ b/server/src/main/java/org/apache/iotdb/db/conf/rest/IoTDBRestServiceConfig.java @@ -21,7 +21,7 @@ package org.apache.iotdb.db.conf.rest; public class IoTDBRestServiceConfig { static final String CONFIG_NAME = "iotdb-common.properties"; /** if the enableRestService is true, we will start REST Service */ - private boolean enableRestService = false; + private boolean enableRestService = true; /** set the REST Service port. */ private int restServicePort = 18080; diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/RequestValidationHandler.java b/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/RequestValidationHandler.java index 2837fbc6e1..27b77596a5 100644 --- a/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/RequestValidationHandler.java +++ b/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/RequestValidationHandler.java @@ -32,22 +32,22 @@ public class RequestValidationHandler { public static void validateSQL(SQL sql) { Objects.requireNonNull(sql.getSql(), "sql should not be null"); if (sql.getRowLimit() != null) { - Validate.isTrue(sql.getRowLimit() > 0, "rowLimit should be positive"); + Validate.isTrue(sql.getRowLimit() > 0, "row_limit should be positive"); } } public static void validateInsertTabletRequest(InsertTabletRequest insertTabletRequest) { Objects.requireNonNull(insertTabletRequest.getTimestamps(), "timestamps should not be null"); - Objects.requireNonNull(insertTabletRequest.getIsAligned(), "isAligned should not be null"); - Objects.requireNonNull(insertTabletRequest.getDeviceId(), "deviceId should not be null"); - Objects.requireNonNull(insertTabletRequest.getDataTypes(), "dataTypes should not be null"); + Objects.requireNonNull(insertTabletRequest.getIsAligned(), "is_aligned should not be null"); + Objects.requireNonNull(insertTabletRequest.getDevice(), "device should not be null"); + Objects.requireNonNull(insertTabletRequest.getDataTypes(), "data_types should not be null"); Objects.requireNonNull(insertTabletRequest.getValues(), "values should not be null"); } public static void validateExpressionRequest(ExpressionRequest expressionRequest) { Objects.requireNonNull(expressionRequest.getExpression(), "expression should not be null"); - Objects.requireNonNull(expressionRequest.getPrefixPath(), "prefixPath should not be null"); - Objects.requireNonNull(expressionRequest.getStartTime(), "startTime should not be null"); - Objects.requireNonNull(expressionRequest.getEndTime(), "endTime should not be null"); + Objects.requireNonNull(expressionRequest.getPrefixPath(), "prefix_path should not be null"); + Objects.requireNonNull(expressionRequest.getStartTime(), "start_time should not be null"); + Objects.requireNonNull(expressionRequest.getEndTime(), "end_time should not be null"); } } diff --git a/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/StatementConstructionHandler.java b/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/StatementConstructionHandler.java index ad53165282..29bd53e9a1 100644 --- a/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/StatementConstructionHandler.java +++ b/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/StatementConstructionHandler.java @@ -38,7 +38,7 @@ public class StatementConstructionHandler { throws IllegalPathException, WriteProcessRejectException { // construct insert statement InsertTabletStatement insertStatement = new InsertTabletStatement(); - insertStatement.setDevicePath(new PartialPath(insertTabletRequest.getDeviceId())); + insertStatement.setDevicePath(new PartialPath(insertTabletRequest.getDevice())); insertStatement.setMeasurements(insertTabletRequest.getMeasurements().toArray(new String[0])); List<List<Object>> rawData = insertTabletRequest.getValues(); List<String> rawDataType = insertTabletRequest.getDataTypes();
