You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/01/10 13:42:03 UTC
[GitHub] [iotdb] SteveYurongSu commented on a change in pull request #4749: [IOTDB-1992] Add english user doc for IoTDB REST data service
SteveYurongSu commented on a change in pull request #4749:
URL: https://github.com/apache/iotdb/pull/4749#discussion_r781200472
##########
File path: docs/UserGuide/Communication-Service-Protocol/RestService.md
##########
@@ -0,0 +1,268 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+## RESTful Service
+IoTDB's RESTful services can be used for query, write, and management operations, using the OpenAPI standard to define interfaces and generate frameworks.
+
+
+
+### Authentication
+RESTful services use basic authentication. Each URL request needs to carry `'Authorization': 'Basic ' + base64.encode(username + ':' + password)`.
+
+
+
+### Interface
+
+#### ping
+
+Request method:`GET`
+
+Request path:http://ip:port/ping
+
+The user name used in the example is:root,password:root
+
+Example request:
+
+```shell
+$ curl -H "Authorization:Basic cm9vdDpyb2901" http://127.0.0.1:18080/ping
+```
+Response parameters:
+
+|parameter name |parameter type |parameter describe|
+|:--- | :--- | :---|
+|code | integer | status code |
+| message | string | message |
+
+Sample response:
+```json
+{
+ "code": 200,
+ "message": "SUCCESS_STATUS"
+}
+```
+Example Of user name and password authentication failure:
+```json
+{
+ "code": 600,
+ "message": "WRONG_LOGIN_PASSWORD_ERROR"
+}
+```
+
+
+
+#### query
+
+Request method:`POST`
+
+Request header:`application/json`
+
+Request path:http://ip:port/rest/v1/query
+
+Parameter Description:
+
+|parameter name |parameter type |is required|parameter describe|
+|:--- | :--- | :---| :---|
+| sql | string | yes | query content |
+
+Example request:
+```shell
+curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X POST --data '{"sql":"select s3, s4, s3 + 1 from root.sg27 limit 2"}' http://127.0.0.1:18080/rest/v1/query
+```
+
+Response parameters:
+
+| parameter name | parameter type | parameter describe|
+| :--- | :--- | --- |
+|expressions | array |An array of result set column names|
+|timestamps | array | Timestamp column |
+|values| array |Value column, the number of columns is the same length as the result set column name array |
+
+Sample response:
+
+```json
+{
+ "expressions": [
+ "root.sg27.s3",
+ "root.sg27.s4",
+ "root.sg27.s3 + 1"
+ ],
+ "timestamps": [1,2],
+ "values": [[11,12],[false,true],[12.0,23.0]]
+}
+```
+
+
+
+#### nonQuery
+
+Request method:`POST`
+
+Request header:`application/json`
+
+Request path:http://ip:port/rest/v1/nonQuery
+
+Parameter Description:
+
+|parameter name |parameter type |parameter describe|
+|:--- | :--- | :---|
+| sql | string | query content |
+
+Example request:
+```shell
+curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X POST --data '{"sql":"set storage group to root.ln"}' http://127.0.0.1:18080/rest/v1/nonQuery
+```
+
+Response parameters:
+
+|parameter name |parameter type |parameter describe|
+|:--- | :--- | :---|
+| code | integer | status code |
+| message | string | message |
+
+Sample response:
+```json
+{
+ "code": 200,
+ "message": "SUCCESS_STATUS"
+}
+```
+
+
+
+#### insertTablet
+
+Request method:`POST`
+
+Request header:`application/json`
+
+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 | boolean | yse | Device name |
Review comment:
```suggestion
| deviceId | boolean | yes | Device name |
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org