Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 42 additions & 19 deletions src/UserGuide/Master/Table/API/RestAPI-V1_apache.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,57 @@ enable_rest_service=true
```

## 2. Authentication

All RESTful APIs adopt **Basic Authentication**, except the health check interface `/ping`.
All requests must carry the `Authorization` information in the request header.

Except for the health check endpoint `/ping`, the RESTful service uses basic authentication. Each URL request must include the header `'Authorization':'Basic' + base64.encode(username + ':' + password)`.

In the example, the username is `root` and the password is `root`. The corresponding Basic authentication header format is:

```Properties
Authorization : Basic cm9vdDpyb290
1. Authentication Format
```
Authorization: Basic <base64_string>
```
The `<base64_string>` is generated by directly Base64-encoding the string in the format `username:password`.
Quick generation methods are shown below:

- If the username or password authentication fails, the following information is returned:

- HTTP status code: 801
* Linux / macOS
```bash
echo -n "your_username:your_password" | base64
eg: echo -n "root:root" | base64
```

- Response body:
* Windows
```powershell
# PowerShell
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("username:password"))
eg: [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:root"))
```
```cmd
# CMD
powershell "[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"username:password\"))"
eg: powershell "[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:root\"))"
```

```JSON
{"code":801,"message":"WRONG_LOGIN_PASSWORD"}
```
2. Authentication Example

- If the `Authorization` header is not set, the following information is returned:
Default username: `root`, password: `root`

- HTTP status code: 800
- Concatenated string: `root:root`
- Base64 encoded result: `cm9vdDpyb290`
- Final Header:
```
Authorization: Basic cm9vdDpyb290
```

- Response body:
3. Error Description
- Incorrect username or password: returns HTTP status code `801`
```json
{"code":801,"message":"WRONG_LOGIN_PASSWORD"}
```

```JSON
{"code":800,"message":"INIT_AUTH_ERROR"}
```
- Missing `Authorization` configuration: returns HTTP status code `800`
```json
{"code":800,"message":"INIT_AUTH_ERROR"}
```


## 3. Interface Definitions

Expand Down
57 changes: 40 additions & 17 deletions src/UserGuide/Master/Table/API/RestAPI-V1_timecho.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,56 @@ enable_rest_service=true

## 2. Authentication

Except for the health check endpoint `/ping`, the RESTful service uses basic authentication. Each URL request must include the header `'Authorization':'Basic' + base64.encode(username + ':' + password)`.
All RESTful APIs adopt **Basic Authentication**, except the health check interface `/ping`.
All requests must carry the `Authorization` information in the request header.

In the example, the username is `root` and the password is `root`. The corresponding Basic authentication header format is:

```Properties
Authorization : Basic cm9vdDpyb290
1. Authentication Format
```
Authorization: Basic <base64_string>
```
The `<base64_string>` is generated by directly Base64-encoding the string in the format `username:password`.
Quick generation methods are shown below:

- If the username or password authentication fails, the following information is returned:
* Linux / macOS
```bash
echo -n "your_username:your_password" | base64
eg: echo -n "root:TimechoDB@2021" | base64
```

- HTTP status code: 801
* Windows
```powershell
# PowerShell
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("username:password"))
eg: [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:TimechoDB@2021"))
```
```cmd
# CMD
powershell "[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"username:password\"))"
eg: powershell "[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:TimechoDB@2021\"))"
```

- Response body:
2. Authentication Example

```JSON
{"code":801,"message":"WRONG_LOGIN_PASSWORD"}
```
Default username: `root`, password: `TimechoDB@2021`

- If the `Authorization` header is not set, the following information is returned:
- Concatenated string: `root:TimechoDB@2021`
- Base64 encoded result: `cm9vdDpUaW1lY2hvREJAMjAyMQ==`
- Final Header:
```
Authorization: Basic cm9vdDpUaW1lY2hvREJAMjAyMQ==
```

- HTTP status code: 800
3. Error Description
- Incorrect username or password: returns HTTP status code `801`
```json
{"code":801,"message":"WRONG_LOGIN_PASSWORD"}
```

- Response body:
- Missing `Authorization` configuration: returns HTTP status code `800`
```json
{"code":800,"message":"INIT_AUTH_ERROR"}
```

```JSON
{"code":800,"message":"INIT_AUTH_ERROR"}
```

## 3. Interface Definitions

Expand Down
61 changes: 39 additions & 22 deletions src/UserGuide/Master/Tree/API/RestServiceV1_apache.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,56 @@ RESTful services are disabled by default.
```

## 2. Authentication
Except the liveness probe API `/ping`, RESTful services use the basic authentication. Each URL request needs to carry `'Authorization': 'Basic ' + base64.encode(username + ':' + password)`.

The username used in the following examples is: `root`, and password is: `root`.
All RESTful services require **Basic authentication** except the health check interface `/ping`. An `Authorization` header must be carried in all requests.

And the authorization header is
1. Authentication Format
```
Authorization: Basic <base64_string>
```
Where `<base64_string>` is the Base64 encoding result of the string formatted as `username:password`. Quick generation methods are as follows:

* Linux/macOS
```bash
echo -n "your_username:your_password" | base64
Example: echo -n "root:root" | base64
```
Authorization: Basic cm9vdDpyb290

* Windows
```powershell
# PowerShell
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("username:password"))
Example: [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:root"))
```

- If a user authorized with incorrect username or password, the following error is returned:
```cmd
# CMD
powershell "[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"username:password\"))"
Example: powershell "[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:root\"))"
```

HTTP Status Code:`401`
2. Authentication Example

HTTP response body:
```json
{
"code": 600,
"message": "WRONG_LOGIN_PASSWORD_ERROR"
}
```
Default username: `root`, default password: `root`:
- Concatenated string: `root:root`
- Base64 encoded result: `cm9vdDpyb290`
- Final Request Header:
```
Authorization: Basic cm9vdDpyb290
```

3. Error Description
- Incorrect username or password: Returns HTTP status code `600` with response content:
```json
{"code":600,"message":"WRONG_LOGIN_PASSWORD_ERROR"}
```

- If the `Authorization` header is missing,the following error is returned:
- Missing `Authorization` header: Returns HTTP status code `603` with response content:
```json
{"code":603,"message":"UNINITIALIZED_AUTH_ERROR"}
```

HTTP Status Code:`401`

HTTP response body:
```json
{
"code": 603,
"message": "UNINITIALIZED_AUTH_ERROR"
}
```

## 3. Interface

Expand Down
69 changes: 37 additions & 32 deletions src/UserGuide/Master/Tree/API/RestServiceV1_timecho.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,48 +26,53 @@ Note: As of version V2.0.8.2, the TimechoDB installation package does not includ

## 1. Enable RESTful Services

RESTful services are disabled by default.
All RESTful services require **Basic authentication** except the health check interface `/ping`. An `Authorization` header must be carried in all requests.

Find the `conf/conf/iotdb-system.properties` file under the IoTDB installation directory and set `enable_rest_service` to `true` to enable the module.
1. Authentication Format
```
Authorization: Basic <base64_string>
```
Where `<base64_string>` is the Base64 encoding result of the string formatted as `username:password`. Quick generation methods are as follows:

```properties
enable_rest_service=true
```
* Linux/macOS
```bash
echo -n "your_username:your_password" | base64
Example: echo -n "root:TimechoDB@2021" | base64
```

## 2. Authentication
Except the liveness probe API `/ping`, RESTful services use the basic authentication. Each URL request needs to carry `'Authorization': 'Basic ' + base64.encode(username + ':' + password)`.
* Windows
```powershell
# PowerShell
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("username:password"))
Example: [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:TimechoDB@2021"))
```

The username used in the following examples is: `root`, and password is: `TimechoDB@2021` //Before V2.0.6.x the default password is root.
```cmd
# CMD
powershell "[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"username:password\"))"
Example: powershell "[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:TimechoDB@2021\"))"
```

And the authorization header is
2. Authentication Example

Default username: `root`, default password: `TimechoDB@2021`:
- Concatenated string: `root:TimechoDB@2021`
- Base64 encoded result: `cm9vdDpUaW1lY2hvREJAMjAyMQ==`
- Final Request Header:
```
Authorization: Basic cm9vdDpyb290
Authorization: Basic cm9vdDpUaW1lY2hvREJAMjAyMQ==
```

- If a user authorized with incorrect username or password, the following error is returned:

HTTP Status Code:`401`

HTTP response body:
```json
{
"code": 600,
"message": "WRONG_LOGIN_PASSWORD_ERROR"
}
```

- If the `Authorization` header is missing,the following error is returned:

HTTP Status Code:`401`
3. Error Description
- Incorrect username or password: Returns HTTP status code `600` with response content:
```json
{"code":600,"message":"WRONG_LOGIN_PASSWORD_ERROR"}
```

HTTP response body:
```json
{
"code": 603,
"message": "UNINITIALIZED_AUTH_ERROR"
}
```
- Missing `Authorization` header: Returns HTTP status code `603` with response content:
```json
{"code":603,"message":"UNINITIALIZED_AUTH_ERROR"}
```

## 3. Interface

Expand Down
60 changes: 38 additions & 22 deletions src/UserGuide/Master/Tree/API/RestServiceV2_apache.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,55 @@ RESTful services are disabled by default.
```

## 2. Authentication
Except the liveness probe API `/ping`, RESTful services use the basic authentication. Each URL request needs to carry `'Authorization': 'Basic ' + base64.encode(username + ':' + password)`.

The username used in the following examples is: `root`, and password is: `root`.
All RESTful services require **Basic authentication** except the health check interface `/ping`. An `Authorization` header must be carried in all requests.

And the authorization header is
1. Authentication Format
```
Authorization: Basic <base64_string>
```
Where `<base64_string>` is the Base64 encoding result of the string formatted as `username:password`. Quick generation methods are as follows:

* Linux/macOS
```bash
echo -n "your_username:your_password" | base64
Example: echo -n "root:root" | base64
```
Authorization: Basic cm9vdDpyb290

* Windows
```powershell
# PowerShell
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("username:password"))
Example: [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:root"))
```

- If a user authorized with incorrect username or password, the following error is returned:
```cmd
# CMD
powershell "[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"username:password\"))"
Example: powershell "[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:root\"))"
```

HTTP Status Code:`401`
2. Authentication Example

HTTP response body:
```json
{
"code": 600,
"message": "WRONG_LOGIN_PASSWORD_ERROR"
}
```
Default username: `root`, default password: `root`:
- Concatenated string: `root:root`
- Base64 encoded result: `cm9vdDpyb290`
- Final Request Header:
```
Authorization: Basic cm9vdDpyb290
```

- If the `Authorization` header is missing,the following error is returned:
3. Error Description
- Incorrect username or password: Returns HTTP status code `600` with response content:
```json
{"code":600,"message":"WRONG_LOGIN_PASSWORD_ERROR"}
```

HTTP Status Code:`401`
- Missing `Authorization` header: Returns HTTP status code `603` with response content:
```json
{"code":603,"message":"UNINITIALIZED_AUTH_ERROR"}
```

HTTP response body:
```json
{
"code": 603,
"message": "UNINITIALIZED_AUTH_ERROR"
}
```

## 3. Interface

Expand Down
Loading
Loading