This is an automated email from the ASF dual-hosted git repository.
HTHou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iotdb-docs.git
The following commit(s) were added to refs/heads/main by this push:
new b7e227a2 update restapi authorization (#1115)
b7e227a2 is described below
commit b7e227a2190c09dbd15f590657bed728910cf32b
Author: leto-b <[email protected]>
AuthorDate: Fri May 15 09:34:40 2026 +0800
update restapi authorization (#1115)
---
.../Master/Table/API/RestAPI-V1_apache.md | 61 +++++++++++++------
.../Master/Table/API/RestAPI-V1_timecho.md | 57 ++++++++++++------
.../Master/Tree/API/RestServiceV1_apache.md | 61 ++++++++++++-------
.../Master/Tree/API/RestServiceV1_timecho.md | 69 ++++++++++++----------
.../Master/Tree/API/RestServiceV2_apache.md | 60 ++++++++++++-------
.../Master/Tree/API/RestServiceV2_timecho.md | 63 ++++++++++++--------
.../latest-Table/API/RestAPI-V1_apache.md | 61 +++++++++++++------
.../latest-Table/API/RestAPI-V1_timecho.md | 57 ++++++++++++------
src/UserGuide/latest/API/RestServiceV1_apache.md | 61 ++++++++++++-------
src/UserGuide/latest/API/RestServiceV1_timecho.md | 69 ++++++++++++----------
src/UserGuide/latest/API/RestServiceV2_apache.md | 60 ++++++++++++-------
src/UserGuide/latest/API/RestServiceV2_timecho.md | 63 ++++++++++++--------
.../Master/Table/API/RestServiceV1_apache.md | 52 ++++++++++++----
.../Master/Table/API/RestServiceV1_timecho.md | 53 +++++++++++++----
.../Master/Tree/API/RestServiceV1_apache.md | 65 +++++++++++++-------
.../Master/Tree/API/RestServiceV1_timecho.md | 64 +++++++++++++-------
.../Master/Tree/API/RestServiceV2_apache.md | 64 +++++++++++++-------
.../Master/Tree/API/RestServiceV2_timecho.md | 64 +++++++++++++-------
.../latest-Table/API/RestServiceV1_apache.md | 52 ++++++++++++----
.../latest-Table/API/RestServiceV1_timecho.md | 53 +++++++++++++----
.../UserGuide/latest/API/RestServiceV1_apache.md | 65 +++++++++++++-------
.../UserGuide/latest/API/RestServiceV1_timecho.md | 64 +++++++++++++-------
.../UserGuide/latest/API/RestServiceV2_apache.md | 64 +++++++++++++-------
.../UserGuide/latest/API/RestServiceV2_timecho.md | 64 +++++++++++++-------
24 files changed, 984 insertions(+), 482 deletions(-)
diff --git a/src/UserGuide/Master/Table/API/RestAPI-V1_apache.md
b/src/UserGuide/Master/Table/API/RestAPI-V1_apache.md
index babf3ac9..42514d87 100644
--- a/src/UserGuide/Master/Table/API/RestAPI-V1_apache.md
+++ b/src/UserGuide/Master/Table/API/RestAPI-V1_apache.md
@@ -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
diff --git a/src/UserGuide/Master/Table/API/RestAPI-V1_timecho.md
b/src/UserGuide/Master/Table/API/RestAPI-V1_timecho.md
index 4d09cac6..21ce0768 100644
--- a/src/UserGuide/Master/Table/API/RestAPI-V1_timecho.md
+++ b/src/UserGuide/Master/Table/API/RestAPI-V1_timecho.md
@@ -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
diff --git a/src/UserGuide/Master/Tree/API/RestServiceV1_apache.md
b/src/UserGuide/Master/Tree/API/RestServiceV1_apache.md
index 532ec3c7..519f7501 100644
--- a/src/UserGuide/Master/Tree/API/RestServiceV1_apache.md
+++ b/src/UserGuide/Master/Tree/API/RestServiceV1_apache.md
@@ -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
diff --git a/src/UserGuide/Master/Tree/API/RestServiceV1_timecho.md
b/src/UserGuide/Master/Tree/API/RestServiceV1_timecho.md
index 5fd28efa..376b21c6 100644
--- a/src/UserGuide/Master/Tree/API/RestServiceV1_timecho.md
+++ b/src/UserGuide/Master/Tree/API/RestServiceV1_timecho.md
@@ -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
diff --git a/src/UserGuide/Master/Tree/API/RestServiceV2_apache.md
b/src/UserGuide/Master/Tree/API/RestServiceV2_apache.md
index f3b97f82..43e9bb4c 100644
--- a/src/UserGuide/Master/Tree/API/RestServiceV2_apache.md
+++ b/src/UserGuide/Master/Tree/API/RestServiceV2_apache.md
@@ -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
diff --git a/src/UserGuide/Master/Tree/API/RestServiceV2_timecho.md
b/src/UserGuide/Master/Tree/API/RestServiceV2_timecho.md
index d3b4e0ea..6a852c48 100644
--- a/src/UserGuide/Master/Tree/API/RestServiceV2_timecho.md
+++ b/src/UserGuide/Master/Tree/API/RestServiceV2_timecho.md
@@ -28,46 +28,63 @@ Note: As of version V2.0.8.2, the TimechoDB installation
package does not includ
RESTful services are disabled by default.
- Find the `conf/iotdb-system.properties` file under the IoTDB installation
directory and set `enable_rest_service` to `true` to enable the module.
+Find the `conf/iotdb-system.properties` file under the IoTDB installation
directory and set `enable_rest_service` to `true` to enable the module.
```properties
enable_rest_service=true
```
## 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:
`TimechoDB@2021` //Before V2.0.6.x the default 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:TimechoDB@2021" | base64
```
-Authorization: Basic cm9vdDpUaW1lY2hvREJAMjAyMQ==
+
+* Windows
+```powershell
+# PowerShell
+[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("username:password"))
+Example:
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:TimechoDB@2021"))
```
-- 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:TimechoDB@2021\"))"
+```
- HTTP Status Code:`401`
+2. Authentication Example
- HTTP response body:
- ```json
- {
- "code": 600,
- "message": "WRONG_LOGIN_PASSWORD_ERROR"
- }
- ```
+Default username: `root`, default password: `TimechoDB@2021`:
+- Concatenated string: `root:TimechoDB@2021`
+- Base64 encoded result: `cm9vdDpUaW1lY2hvREJAMjAyMQ==`
+- Final Request Header:
+```
+Authorization: Basic cm9vdDpUaW1lY2hvREJAMjAyMQ==
+```
+
+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
diff --git a/src/UserGuide/latest-Table/API/RestAPI-V1_apache.md
b/src/UserGuide/latest-Table/API/RestAPI-V1_apache.md
index babf3ac9..42514d87 100644
--- a/src/UserGuide/latest-Table/API/RestAPI-V1_apache.md
+++ b/src/UserGuide/latest-Table/API/RestAPI-V1_apache.md
@@ -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
diff --git a/src/UserGuide/latest-Table/API/RestAPI-V1_timecho.md
b/src/UserGuide/latest-Table/API/RestAPI-V1_timecho.md
index 4d09cac6..21ce0768 100644
--- a/src/UserGuide/latest-Table/API/RestAPI-V1_timecho.md
+++ b/src/UserGuide/latest-Table/API/RestAPI-V1_timecho.md
@@ -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
diff --git a/src/UserGuide/latest/API/RestServiceV1_apache.md
b/src/UserGuide/latest/API/RestServiceV1_apache.md
index 532ec3c7..519f7501 100644
--- a/src/UserGuide/latest/API/RestServiceV1_apache.md
+++ b/src/UserGuide/latest/API/RestServiceV1_apache.md
@@ -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
diff --git a/src/UserGuide/latest/API/RestServiceV1_timecho.md
b/src/UserGuide/latest/API/RestServiceV1_timecho.md
index 5fd28efa..376b21c6 100644
--- a/src/UserGuide/latest/API/RestServiceV1_timecho.md
+++ b/src/UserGuide/latest/API/RestServiceV1_timecho.md
@@ -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
diff --git a/src/UserGuide/latest/API/RestServiceV2_apache.md
b/src/UserGuide/latest/API/RestServiceV2_apache.md
index f3b97f82..43e9bb4c 100644
--- a/src/UserGuide/latest/API/RestServiceV2_apache.md
+++ b/src/UserGuide/latest/API/RestServiceV2_apache.md
@@ -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
diff --git a/src/UserGuide/latest/API/RestServiceV2_timecho.md
b/src/UserGuide/latest/API/RestServiceV2_timecho.md
index d3b4e0ea..6a852c48 100644
--- a/src/UserGuide/latest/API/RestServiceV2_timecho.md
+++ b/src/UserGuide/latest/API/RestServiceV2_timecho.md
@@ -28,46 +28,63 @@ Note: As of version V2.0.8.2, the TimechoDB installation
package does not includ
RESTful services are disabled by default.
- Find the `conf/iotdb-system.properties` file under the IoTDB installation
directory and set `enable_rest_service` to `true` to enable the module.
+Find the `conf/iotdb-system.properties` file under the IoTDB installation
directory and set `enable_rest_service` to `true` to enable the module.
```properties
enable_rest_service=true
```
## 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:
`TimechoDB@2021` //Before V2.0.6.x the default 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:TimechoDB@2021" | base64
```
-Authorization: Basic cm9vdDpUaW1lY2hvREJAMjAyMQ==
+
+* Windows
+```powershell
+# PowerShell
+[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("username:password"))
+Example:
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:TimechoDB@2021"))
```
-- 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:TimechoDB@2021\"))"
+```
- HTTP Status Code:`401`
+2. Authentication Example
- HTTP response body:
- ```json
- {
- "code": 600,
- "message": "WRONG_LOGIN_PASSWORD_ERROR"
- }
- ```
+Default username: `root`, default password: `TimechoDB@2021`:
+- Concatenated string: `root:TimechoDB@2021`
+- Base64 encoded result: `cm9vdDpUaW1lY2hvREJAMjAyMQ==`
+- Final Request Header:
+```
+Authorization: Basic cm9vdDpUaW1lY2hvREJAMjAyMQ==
+```
+
+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
diff --git a/src/zh/UserGuide/Master/Table/API/RestServiceV1_apache.md
b/src/zh/UserGuide/Master/Table/API/RestServiceV1_apache.md
index 16fe3044..840a48a0 100644
--- a/src/zh/UserGuide/Master/Table/API/RestServiceV1_apache.md
+++ b/src/zh/UserGuide/Master/Table/API/RestServiceV1_apache.md
@@ -33,27 +33,57 @@ Restful 服务默认情况是关闭的,开启 restful 功能需要找到 IoTDB
## 2. 鉴权
-除了检活接口 `/ping`,restful服务使用了基础(basic)鉴权,每次 URL 请求都需要在 header 中携带
`'Authorization':'Basic' + base64.encode(username + ':' + password)`。
+除了检活接口 `/ping`,RESTful 服务均使用基础(Basic)鉴权,所有请求都需要在 Header 中携带 `Authorization` 信息。
-示例中使用的用户名为:`root`,密码为:`root`,对应的 Basic 鉴权 Header 格式为
+1. 鉴权格式
-```Plain
-Authorization : Basic cm9vdDpyb290
+```JSON
+Authorization: Basic <base64串>
+```
+
+其中 `<base64串>` 是 `用户名:密码` 直接做 Base64 编码的结果,其快速生成方式如下
+
+* Linux/macOS
+
+```Bash
+echo -n "你的用户名:你的密码" | base64
+eg: echo -n "root:root" | base64
+```
+
+* Windows
+
+```Bash
+# PowerShell
+[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("用户名:密码"))
+eg:
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:root"))
+
+# CMD
+powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"用户名:密码\"))"
+eg: powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:root\"))"
```
-- 若用户名密码认证失败,则返回如下信息:
-- HTTP 状态码:801
-- 返回结构体如下
+2. 鉴权示例
+
+默认用户名 `root`,密码 `root`:
+
+* 拼接字符串:`root:root`
+* Base64 编码后为:`cm9vdDpyb290`
+* 最终 Header:
+
+```JSON
+Authorization: Basic cm9vdDpyb290
+```
+
+3. 错误说明
+* 用户名/密码错误:返回 HTTP 状态码 `801`,内容:
```JSON
{"code":801,"message":"WRONG_LOGIN_PASSWORD"}
```
-- 若未设置 `Authorization`,则返回如下信息:
-- HTTP 状态码:800
-- 返回结构体如下
+* 未设置 `Authorization`:返回 HTTP 状态码 `800`,内容:
-```Plain
+```JSON
{"code":800,"message":"INIT_AUTH_ERROR"}
```
diff --git a/src/zh/UserGuide/Master/Table/API/RestServiceV1_timecho.md
b/src/zh/UserGuide/Master/Table/API/RestServiceV1_timecho.md
index 5b1fba36..117ba16b 100644
--- a/src/zh/UserGuide/Master/Table/API/RestServiceV1_timecho.md
+++ b/src/zh/UserGuide/Master/Table/API/RestServiceV1_timecho.md
@@ -35,30 +35,61 @@ Restful 服务默认情况是关闭的,开启 restful 功能需要找到 IoTDB
## 2. 鉴权
-除了检活接口 `/ping`,restful服务使用了基础(basic)鉴权,每次 URL 请求都需要在 header 中携带
`'Authorization':'Basic' + base64.encode(username + ':' + password)`。
+除了检活接口 `/ping`,RESTful 服务均使用基础(Basic)鉴权,所有请求都需要在 Header 中携带 `Authorization` 信息。
-示例中使用的用户名为:`root`,密码为:`root`,对应的 Basic 鉴权 Header 格式为
+1. 鉴权格式
-```Plain
-Authorization : Basic cm9vdDpyb290
+```JSON
+Authorization: Basic <base64串>
+```
+
+其中 `<base64串>` 是 `用户名:密码` 直接做 Base64 编码的结果,其快速生成方式如下
+
+* Linux/macOS
+
+```Bash
+echo -n "你的用户名:你的密码" | base64
+eg: echo -n "root:TimechoDB@2021" | base64
+```
+
+* Windows
+
+```Bash
+# PowerShell
+[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("用户名:密码"))
+eg:
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:TimechoDB@2021"))
+
+# CMD
+powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"用户名:密码\"))"
+eg: powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:TimechoDB@2021\"))"
```
-- 若用户名密码认证失败,则返回如下信息:
-- HTTP 状态码:801
-- 返回结构体如下
+2. 鉴权示例
+
+默认用户名 `root`,密码 `TimechoDB@2021`:
+
+* 拼接字符串:`root:TimechoDB@2021`
+* Base64 编码后为:`cm9vdDpUaW1lY2hvREJAMjAyMQ==`
+* 最终 Header:
+
+```JSON
+Authorization: Basic cm9vdDpUaW1lY2hvREJAMjAyMQ==
+```
+
+3. 错误说明
+* 用户名/密码错误:返回 HTTP 状态码 `801`,内容:
```JSON
{"code":801,"message":"WRONG_LOGIN_PASSWORD"}
```
-- 若未设置 `Authorization`,则返回如下信息:
-- HTTP 状态码:800
-- 返回结构体如下
+* 未设置 `Authorization`:返回 HTTP 状态码 `800`,内容:
-```Plain
+```JSON
{"code":800,"message":"INIT_AUTH_ERROR"}
```
+
## 3. 接口定义
### 3.1 ping
diff --git a/src/zh/UserGuide/Master/Tree/API/RestServiceV1_apache.md
b/src/zh/UserGuide/Master/Tree/API/RestServiceV1_apache.md
index 57af0d22..c1b50601 100644
--- a/src/zh/UserGuide/Master/Tree/API/RestServiceV1_apache.md
+++ b/src/zh/UserGuide/Master/Tree/API/RestServiceV1_apache.md
@@ -32,37 +32,60 @@ RESTful 服务默认情况是关闭的
```
## 2. 鉴权
-除了检活接口 `/ping`,RESTful 服务使用了基础(basic)鉴权,每次 URL 请求都需要在 header 中携带
`'Authorization': 'Basic ' + base64.encode(username + ':' + password)`。
+除了检活接口 `/ping`,RESTful 服务均使用基础(Basic)鉴权,所有请求都需要在 Header 中携带 `Authorization` 信息。
-示例中使用的用户名为:`root`,密码为:`root`,对应的 Basic 鉴权 Header 格式为
+1. 鉴权格式
+```JSON
+Authorization: Basic <base64串>
```
-Authorization: Basic cm9vdDpyb290
+
+其中 `<base64串>` 是 `用户名:密码` 直接做 Base64 编码的结果,其快速生成方式如下
+
+* Linux/macOS
+
+```Bash
+echo -n "你的用户名:你的密码" | base64
+eg: echo -n "root:root" | base64
```
-- 若用户名密码认证失败,则返回如下信息:
+* Windows
- HTTP 状态码:`401`
+```Bash
+# PowerShell
+[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("用户名:密码"))
+eg:
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:root"))
- 返回结构体如下
- ```json
- {
- "code": 600,
- "message": "WRONG_LOGIN_PASSWORD_ERROR"
- }
- ```
+# CMD
+powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"用户名:密码\"))"
+eg: powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:root\"))"
+```
+
+2. 鉴权示例
-- 若未设置 `Authorization`,则返回如下信息:
+默认用户名 `root`,密码 `root`:
- HTTP 状态码:`401`
+* 拼接字符串:`root:root`
+* Base64 编码后为:`cm9vdDpyb290`
+* 最终 Header:
+
+```JSON
+Authorization: Basic cm9vdDpyb290
+```
+
+3. 错误说明
+* 用户名/密码错误:返回 HTTP 状态码 `600`,内容:
+
+```JSON
+{"code":600,"message":"WRONG_LOGIN_PASSWORD_ERROR"}
+```
+
+* 未设置 `Authorization`:返回 HTTP 状态码 `603`,内容:
+
+```JSON
+{"code":603,"message":"UNINITIALIZED_AUTH_ERROR"}
+```
- 返回结构体如下
- ```json
- {
- "code": 603,
- "message": "UNINITIALIZED_AUTH_ERROR"
- }
- ```
## 3. 接口
diff --git a/src/zh/UserGuide/Master/Tree/API/RestServiceV1_timecho.md
b/src/zh/UserGuide/Master/Tree/API/RestServiceV1_timecho.md
index d09bad4e..239d57ee 100644
--- a/src/zh/UserGuide/Master/Tree/API/RestServiceV1_timecho.md
+++ b/src/zh/UserGuide/Master/Tree/API/RestServiceV1_timecho.md
@@ -34,37 +34,59 @@ RESTful 服务默认情况是关闭的
```
## 2. 鉴权
-除了检活接口 `/ping`,RESTful 服务使用了基础(basic)鉴权,每次 URL 请求都需要在 header 中携带
`'Authorization': 'Basic ' + base64.encode(username + ':' + password)`。
+除了检活接口 `/ping`,RESTful 服务均使用基础(Basic)鉴权,所有请求都需要在 Header 中携带 `Authorization` 信息。
-示例中使用的用户名为:`root`,密码为:`TimechoDB@2021`,对应的 Basic 鉴权 Header 格式为
+1. 鉴权格式
+```JSON
+Authorization: Basic <base64串>
```
-Authorization: Basic cm9vdDpyb290
+
+其中 `<base64串>` 是 `用户名:密码` 直接做 Base64 编码的结果,其快速生成方式如下
+
+* Linux/macOS
+
+```Bash
+echo -n "你的用户名:你的密码" | base64
+eg: echo -n "root:TimechoDB@2021" | base64
+```
+
+* Windows
+
+```Bash
+# PowerShell
+[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("用户名:密码"))
+eg:
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:TimechoDB@2021"))
+
+# CMD
+powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"用户名:密码\"))"
+eg: powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:TimechoDB@2021\"))"
```
-- 若用户名密码认证失败,则返回如下信息:
+2. 鉴权示例
+
+默认用户名 `root`,密码 `TimechoDB@2021`:
+
+* 拼接字符串:`root:TimechoDB@2021`
+* Base64 编码后为:`cm9vdDpUaW1lY2hvREJAMjAyMQ==`
+* 最终 Header:
- HTTP 状态码:`401`
+```JSON
+Authorization: Basic cm9vdDpUaW1lY2hvREJAMjAyMQ==
+```
- 返回结构体如下
- ```json
- {
- "code": 600,
- "message": "WRONG_LOGIN_PASSWORD_ERROR"
- }
- ```
+3. 错误说明
+* 用户名/密码错误:返回 HTTP 状态码 `600`,内容:
-- 若未设置 `Authorization`,则返回如下信息:
+```JSON
+{"code":600,"message":"WRONG_LOGIN_PASSWORD_ERROR"}
+```
- HTTP 状态码:`401`
+* 未设置 `Authorization`:返回 HTTP 状态码 `603`,内容:
- 返回结构体如下
- ```json
- {
- "code": 603,
- "message": "UNINITIALIZED_AUTH_ERROR"
- }
- ```
+```JSON
+{"code":603,"message":"UNINITIALIZED_AUTH_ERROR"}
+```
## 3. 接口
diff --git a/src/zh/UserGuide/Master/Tree/API/RestServiceV2_apache.md
b/src/zh/UserGuide/Master/Tree/API/RestServiceV2_apache.md
index 42b33dc4..74f3a6b5 100644
--- a/src/zh/UserGuide/Master/Tree/API/RestServiceV2_apache.md
+++ b/src/zh/UserGuide/Master/Tree/API/RestServiceV2_apache.md
@@ -32,37 +32,59 @@ RESTful 服务默认情况是关闭的
```
## 2. 鉴权
-除了检活接口 `/ping`,RESTful 服务使用了基础(basic)鉴权,每次 URL 请求都需要在 header 中携带
`'Authorization': 'Basic ' + base64.encode(username + ':' + password)`。
+除了检活接口 `/ping`,RESTful 服务均使用基础(Basic)鉴权,所有请求都需要在 Header 中携带 `Authorization` 信息。
-示例中使用的用户名为:`root`,密码为:`root`,对应的 Basic 鉴权 Header 格式为
+1. 鉴权格式
+```JSON
+Authorization: Basic <base64串>
```
-Authorization: Basic cm9vdDpyb290
+
+其中 `<base64串>` 是 `用户名:密码` 直接做 Base64 编码的结果,其快速生成方式如下
+
+* Linux/macOS
+
+```Bash
+echo -n "你的用户名:你的密码" | base64
+eg: echo -n "root:root" | base64
+```
+
+* Windows
+
+```Bash
+# PowerShell
+[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("用户名:密码"))
+eg:
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:root"))
+
+# CMD
+powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"用户名:密码\"))"
+eg: powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:root\"))"
```
-- 若用户名密码认证失败,则返回如下信息:
+2. 鉴权示例
- HTTP 状态码:`401`
+默认用户名 `root`,密码 `root`:
- 返回结构体如下
- ```json
- {
- "code": 600,
- "message": "WRONG_LOGIN_PASSWORD_ERROR"
- }
- ```
+* 拼接字符串:`root:root`
+* Base64 编码后为:`cm9vdDpyb290`
+* 最终 Header:
-- 若未设置 `Authorization`,则返回如下信息:
+```JSON
+Authorization: Basic cm9vdDpyb290
+```
- HTTP 状态码:`401`
+3. 错误说明
+* 用户名/密码错误:返回 HTTP 状态码 `600`,内容:
- 返回结构体如下
- ```json
- {
- "code": 603,
- "message": "UNINITIALIZED_AUTH_ERROR"
- }
- ```
+```JSON
+{"code":600,"message":"WRONG_LOGIN_PASSWORD_ERROR"}
+```
+
+* 未设置 `Authorization`:返回 HTTP 状态码 `603`,内容:
+
+```JSON
+{"code":603,"message":"UNINITIALIZED_AUTH_ERROR"}
+```
## 3. 接口
diff --git a/src/zh/UserGuide/Master/Tree/API/RestServiceV2_timecho.md
b/src/zh/UserGuide/Master/Tree/API/RestServiceV2_timecho.md
index 0a094a0b..629c40fb 100644
--- a/src/zh/UserGuide/Master/Tree/API/RestServiceV2_timecho.md
+++ b/src/zh/UserGuide/Master/Tree/API/RestServiceV2_timecho.md
@@ -34,37 +34,59 @@ RESTful 服务默认情况是关闭的
```
## 2. 鉴权
-除了检活接口 `/ping`,RESTful 服务使用了基础(basic)鉴权,每次 URL 请求都需要在 header 中携带
`'Authorization': 'Basic ' + base64.encode(username + ':' + password)`。
+除了检活接口 `/ping`,RESTful 服务均使用基础(Basic)鉴权,所有请求都需要在 Header 中携带 `Authorization` 信息。
-示例中使用的用户名为:`root`,密码为:`TimechoDB@2021`,对应的 Basic 鉴权 Header 格式为
+1. 鉴权格式
+```JSON
+Authorization: Basic <base64串>
```
-Authorization: Basic cm9vdDpUaW1lY2hvREJAMjAyMQ==
+
+其中 `<base64串>` 是 `用户名:密码` 直接做 Base64 编码的结果,其快速生成方式如下
+
+* Linux/macOS
+
+```Bash
+echo -n "你的用户名:你的密码" | base64
+eg: echo -n "root:TimechoDB@2021" | base64
+```
+
+* Windows
+
+```Bash
+# PowerShell
+[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("用户名:密码"))
+eg:
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:TimechoDB@2021"))
+
+# CMD
+powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"用户名:密码\"))"
+eg: powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:TimechoDB@2021\"))"
```
-- 若用户名密码认证失败,则返回如下信息:
+2. 鉴权示例
- HTTP 状态码:`401`
+默认用户名 `root`,密码 `TimechoDB@2021`:
- 返回结构体如下
- ```json
- {
- "code": 600,
- "message": "WRONG_LOGIN_PASSWORD_ERROR"
- }
- ```
+* 拼接字符串:`root:TimechoDB@2021`
+* Base64 编码后为:`cm9vdDpUaW1lY2hvREJAMjAyMQ==`
+* 最终 Header:
-- 若未设置 `Authorization`,则返回如下信息:
+```JSON
+Authorization: Basic cm9vdDpUaW1lY2hvREJAMjAyMQ==
+```
- HTTP 状态码:`401`
+3. 错误说明
+* 用户名/密码错误:返回 HTTP 状态码 `600`,内容:
- 返回结构体如下
- ```json
- {
- "code": 603,
- "message": "UNINITIALIZED_AUTH_ERROR"
- }
- ```
+```JSON
+{"code":600,"message":"WRONG_LOGIN_PASSWORD_ERROR"}
+```
+
+* 未设置 `Authorization`:返回 HTTP 状态码 `603`,内容:
+
+```JSON
+{"code":603,"message":"UNINITIALIZED_AUTH_ERROR"}
+```
## 3. 接口
diff --git a/src/zh/UserGuide/latest-Table/API/RestServiceV1_apache.md
b/src/zh/UserGuide/latest-Table/API/RestServiceV1_apache.md
index 16fe3044..840a48a0 100644
--- a/src/zh/UserGuide/latest-Table/API/RestServiceV1_apache.md
+++ b/src/zh/UserGuide/latest-Table/API/RestServiceV1_apache.md
@@ -33,27 +33,57 @@ Restful 服务默认情况是关闭的,开启 restful 功能需要找到 IoTDB
## 2. 鉴权
-除了检活接口 `/ping`,restful服务使用了基础(basic)鉴权,每次 URL 请求都需要在 header 中携带
`'Authorization':'Basic' + base64.encode(username + ':' + password)`。
+除了检活接口 `/ping`,RESTful 服务均使用基础(Basic)鉴权,所有请求都需要在 Header 中携带 `Authorization` 信息。
-示例中使用的用户名为:`root`,密码为:`root`,对应的 Basic 鉴权 Header 格式为
+1. 鉴权格式
-```Plain
-Authorization : Basic cm9vdDpyb290
+```JSON
+Authorization: Basic <base64串>
+```
+
+其中 `<base64串>` 是 `用户名:密码` 直接做 Base64 编码的结果,其快速生成方式如下
+
+* Linux/macOS
+
+```Bash
+echo -n "你的用户名:你的密码" | base64
+eg: echo -n "root:root" | base64
+```
+
+* Windows
+
+```Bash
+# PowerShell
+[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("用户名:密码"))
+eg:
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:root"))
+
+# CMD
+powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"用户名:密码\"))"
+eg: powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:root\"))"
```
-- 若用户名密码认证失败,则返回如下信息:
-- HTTP 状态码:801
-- 返回结构体如下
+2. 鉴权示例
+
+默认用户名 `root`,密码 `root`:
+
+* 拼接字符串:`root:root`
+* Base64 编码后为:`cm9vdDpyb290`
+* 最终 Header:
+
+```JSON
+Authorization: Basic cm9vdDpyb290
+```
+
+3. 错误说明
+* 用户名/密码错误:返回 HTTP 状态码 `801`,内容:
```JSON
{"code":801,"message":"WRONG_LOGIN_PASSWORD"}
```
-- 若未设置 `Authorization`,则返回如下信息:
-- HTTP 状态码:800
-- 返回结构体如下
+* 未设置 `Authorization`:返回 HTTP 状态码 `800`,内容:
-```Plain
+```JSON
{"code":800,"message":"INIT_AUTH_ERROR"}
```
diff --git a/src/zh/UserGuide/latest-Table/API/RestServiceV1_timecho.md
b/src/zh/UserGuide/latest-Table/API/RestServiceV1_timecho.md
index 5b1fba36..117ba16b 100644
--- a/src/zh/UserGuide/latest-Table/API/RestServiceV1_timecho.md
+++ b/src/zh/UserGuide/latest-Table/API/RestServiceV1_timecho.md
@@ -35,30 +35,61 @@ Restful 服务默认情况是关闭的,开启 restful 功能需要找到 IoTDB
## 2. 鉴权
-除了检活接口 `/ping`,restful服务使用了基础(basic)鉴权,每次 URL 请求都需要在 header 中携带
`'Authorization':'Basic' + base64.encode(username + ':' + password)`。
+除了检活接口 `/ping`,RESTful 服务均使用基础(Basic)鉴权,所有请求都需要在 Header 中携带 `Authorization` 信息。
-示例中使用的用户名为:`root`,密码为:`root`,对应的 Basic 鉴权 Header 格式为
+1. 鉴权格式
-```Plain
-Authorization : Basic cm9vdDpyb290
+```JSON
+Authorization: Basic <base64串>
+```
+
+其中 `<base64串>` 是 `用户名:密码` 直接做 Base64 编码的结果,其快速生成方式如下
+
+* Linux/macOS
+
+```Bash
+echo -n "你的用户名:你的密码" | base64
+eg: echo -n "root:TimechoDB@2021" | base64
+```
+
+* Windows
+
+```Bash
+# PowerShell
+[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("用户名:密码"))
+eg:
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:TimechoDB@2021"))
+
+# CMD
+powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"用户名:密码\"))"
+eg: powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:TimechoDB@2021\"))"
```
-- 若用户名密码认证失败,则返回如下信息:
-- HTTP 状态码:801
-- 返回结构体如下
+2. 鉴权示例
+
+默认用户名 `root`,密码 `TimechoDB@2021`:
+
+* 拼接字符串:`root:TimechoDB@2021`
+* Base64 编码后为:`cm9vdDpUaW1lY2hvREJAMjAyMQ==`
+* 最终 Header:
+
+```JSON
+Authorization: Basic cm9vdDpUaW1lY2hvREJAMjAyMQ==
+```
+
+3. 错误说明
+* 用户名/密码错误:返回 HTTP 状态码 `801`,内容:
```JSON
{"code":801,"message":"WRONG_LOGIN_PASSWORD"}
```
-- 若未设置 `Authorization`,则返回如下信息:
-- HTTP 状态码:800
-- 返回结构体如下
+* 未设置 `Authorization`:返回 HTTP 状态码 `800`,内容:
-```Plain
+```JSON
{"code":800,"message":"INIT_AUTH_ERROR"}
```
+
## 3. 接口定义
### 3.1 ping
diff --git a/src/zh/UserGuide/latest/API/RestServiceV1_apache.md
b/src/zh/UserGuide/latest/API/RestServiceV1_apache.md
index 57af0d22..c1b50601 100644
--- a/src/zh/UserGuide/latest/API/RestServiceV1_apache.md
+++ b/src/zh/UserGuide/latest/API/RestServiceV1_apache.md
@@ -32,37 +32,60 @@ RESTful 服务默认情况是关闭的
```
## 2. 鉴权
-除了检活接口 `/ping`,RESTful 服务使用了基础(basic)鉴权,每次 URL 请求都需要在 header 中携带
`'Authorization': 'Basic ' + base64.encode(username + ':' + password)`。
+除了检活接口 `/ping`,RESTful 服务均使用基础(Basic)鉴权,所有请求都需要在 Header 中携带 `Authorization` 信息。
-示例中使用的用户名为:`root`,密码为:`root`,对应的 Basic 鉴权 Header 格式为
+1. 鉴权格式
+```JSON
+Authorization: Basic <base64串>
```
-Authorization: Basic cm9vdDpyb290
+
+其中 `<base64串>` 是 `用户名:密码` 直接做 Base64 编码的结果,其快速生成方式如下
+
+* Linux/macOS
+
+```Bash
+echo -n "你的用户名:你的密码" | base64
+eg: echo -n "root:root" | base64
```
-- 若用户名密码认证失败,则返回如下信息:
+* Windows
- HTTP 状态码:`401`
+```Bash
+# PowerShell
+[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("用户名:密码"))
+eg:
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:root"))
- 返回结构体如下
- ```json
- {
- "code": 600,
- "message": "WRONG_LOGIN_PASSWORD_ERROR"
- }
- ```
+# CMD
+powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"用户名:密码\"))"
+eg: powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:root\"))"
+```
+
+2. 鉴权示例
-- 若未设置 `Authorization`,则返回如下信息:
+默认用户名 `root`,密码 `root`:
- HTTP 状态码:`401`
+* 拼接字符串:`root:root`
+* Base64 编码后为:`cm9vdDpyb290`
+* 最终 Header:
+
+```JSON
+Authorization: Basic cm9vdDpyb290
+```
+
+3. 错误说明
+* 用户名/密码错误:返回 HTTP 状态码 `600`,内容:
+
+```JSON
+{"code":600,"message":"WRONG_LOGIN_PASSWORD_ERROR"}
+```
+
+* 未设置 `Authorization`:返回 HTTP 状态码 `603`,内容:
+
+```JSON
+{"code":603,"message":"UNINITIALIZED_AUTH_ERROR"}
+```
- 返回结构体如下
- ```json
- {
- "code": 603,
- "message": "UNINITIALIZED_AUTH_ERROR"
- }
- ```
## 3. 接口
diff --git a/src/zh/UserGuide/latest/API/RestServiceV1_timecho.md
b/src/zh/UserGuide/latest/API/RestServiceV1_timecho.md
index d09bad4e..239d57ee 100644
--- a/src/zh/UserGuide/latest/API/RestServiceV1_timecho.md
+++ b/src/zh/UserGuide/latest/API/RestServiceV1_timecho.md
@@ -34,37 +34,59 @@ RESTful 服务默认情况是关闭的
```
## 2. 鉴权
-除了检活接口 `/ping`,RESTful 服务使用了基础(basic)鉴权,每次 URL 请求都需要在 header 中携带
`'Authorization': 'Basic ' + base64.encode(username + ':' + password)`。
+除了检活接口 `/ping`,RESTful 服务均使用基础(Basic)鉴权,所有请求都需要在 Header 中携带 `Authorization` 信息。
-示例中使用的用户名为:`root`,密码为:`TimechoDB@2021`,对应的 Basic 鉴权 Header 格式为
+1. 鉴权格式
+```JSON
+Authorization: Basic <base64串>
```
-Authorization: Basic cm9vdDpyb290
+
+其中 `<base64串>` 是 `用户名:密码` 直接做 Base64 编码的结果,其快速生成方式如下
+
+* Linux/macOS
+
+```Bash
+echo -n "你的用户名:你的密码" | base64
+eg: echo -n "root:TimechoDB@2021" | base64
+```
+
+* Windows
+
+```Bash
+# PowerShell
+[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("用户名:密码"))
+eg:
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:TimechoDB@2021"))
+
+# CMD
+powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"用户名:密码\"))"
+eg: powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:TimechoDB@2021\"))"
```
-- 若用户名密码认证失败,则返回如下信息:
+2. 鉴权示例
+
+默认用户名 `root`,密码 `TimechoDB@2021`:
+
+* 拼接字符串:`root:TimechoDB@2021`
+* Base64 编码后为:`cm9vdDpUaW1lY2hvREJAMjAyMQ==`
+* 最终 Header:
- HTTP 状态码:`401`
+```JSON
+Authorization: Basic cm9vdDpUaW1lY2hvREJAMjAyMQ==
+```
- 返回结构体如下
- ```json
- {
- "code": 600,
- "message": "WRONG_LOGIN_PASSWORD_ERROR"
- }
- ```
+3. 错误说明
+* 用户名/密码错误:返回 HTTP 状态码 `600`,内容:
-- 若未设置 `Authorization`,则返回如下信息:
+```JSON
+{"code":600,"message":"WRONG_LOGIN_PASSWORD_ERROR"}
+```
- HTTP 状态码:`401`
+* 未设置 `Authorization`:返回 HTTP 状态码 `603`,内容:
- 返回结构体如下
- ```json
- {
- "code": 603,
- "message": "UNINITIALIZED_AUTH_ERROR"
- }
- ```
+```JSON
+{"code":603,"message":"UNINITIALIZED_AUTH_ERROR"}
+```
## 3. 接口
diff --git a/src/zh/UserGuide/latest/API/RestServiceV2_apache.md
b/src/zh/UserGuide/latest/API/RestServiceV2_apache.md
index 42b33dc4..74f3a6b5 100644
--- a/src/zh/UserGuide/latest/API/RestServiceV2_apache.md
+++ b/src/zh/UserGuide/latest/API/RestServiceV2_apache.md
@@ -32,37 +32,59 @@ RESTful 服务默认情况是关闭的
```
## 2. 鉴权
-除了检活接口 `/ping`,RESTful 服务使用了基础(basic)鉴权,每次 URL 请求都需要在 header 中携带
`'Authorization': 'Basic ' + base64.encode(username + ':' + password)`。
+除了检活接口 `/ping`,RESTful 服务均使用基础(Basic)鉴权,所有请求都需要在 Header 中携带 `Authorization` 信息。
-示例中使用的用户名为:`root`,密码为:`root`,对应的 Basic 鉴权 Header 格式为
+1. 鉴权格式
+```JSON
+Authorization: Basic <base64串>
```
-Authorization: Basic cm9vdDpyb290
+
+其中 `<base64串>` 是 `用户名:密码` 直接做 Base64 编码的结果,其快速生成方式如下
+
+* Linux/macOS
+
+```Bash
+echo -n "你的用户名:你的密码" | base64
+eg: echo -n "root:root" | base64
+```
+
+* Windows
+
+```Bash
+# PowerShell
+[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("用户名:密码"))
+eg:
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:root"))
+
+# CMD
+powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"用户名:密码\"))"
+eg: powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:root\"))"
```
-- 若用户名密码认证失败,则返回如下信息:
+2. 鉴权示例
- HTTP 状态码:`401`
+默认用户名 `root`,密码 `root`:
- 返回结构体如下
- ```json
- {
- "code": 600,
- "message": "WRONG_LOGIN_PASSWORD_ERROR"
- }
- ```
+* 拼接字符串:`root:root`
+* Base64 编码后为:`cm9vdDpyb290`
+* 最终 Header:
-- 若未设置 `Authorization`,则返回如下信息:
+```JSON
+Authorization: Basic cm9vdDpyb290
+```
- HTTP 状态码:`401`
+3. 错误说明
+* 用户名/密码错误:返回 HTTP 状态码 `600`,内容:
- 返回结构体如下
- ```json
- {
- "code": 603,
- "message": "UNINITIALIZED_AUTH_ERROR"
- }
- ```
+```JSON
+{"code":600,"message":"WRONG_LOGIN_PASSWORD_ERROR"}
+```
+
+* 未设置 `Authorization`:返回 HTTP 状态码 `603`,内容:
+
+```JSON
+{"code":603,"message":"UNINITIALIZED_AUTH_ERROR"}
+```
## 3. 接口
diff --git a/src/zh/UserGuide/latest/API/RestServiceV2_timecho.md
b/src/zh/UserGuide/latest/API/RestServiceV2_timecho.md
index 0a094a0b..629c40fb 100644
--- a/src/zh/UserGuide/latest/API/RestServiceV2_timecho.md
+++ b/src/zh/UserGuide/latest/API/RestServiceV2_timecho.md
@@ -34,37 +34,59 @@ RESTful 服务默认情况是关闭的
```
## 2. 鉴权
-除了检活接口 `/ping`,RESTful 服务使用了基础(basic)鉴权,每次 URL 请求都需要在 header 中携带
`'Authorization': 'Basic ' + base64.encode(username + ':' + password)`。
+除了检活接口 `/ping`,RESTful 服务均使用基础(Basic)鉴权,所有请求都需要在 Header 中携带 `Authorization` 信息。
-示例中使用的用户名为:`root`,密码为:`TimechoDB@2021`,对应的 Basic 鉴权 Header 格式为
+1. 鉴权格式
+```JSON
+Authorization: Basic <base64串>
```
-Authorization: Basic cm9vdDpUaW1lY2hvREJAMjAyMQ==
+
+其中 `<base64串>` 是 `用户名:密码` 直接做 Base64 编码的结果,其快速生成方式如下
+
+* Linux/macOS
+
+```Bash
+echo -n "你的用户名:你的密码" | base64
+eg: echo -n "root:TimechoDB@2021" | base64
+```
+
+* Windows
+
+```Bash
+# PowerShell
+[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("用户名:密码"))
+eg:
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("root:TimechoDB@2021"))
+
+# CMD
+powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"用户名:密码\"))"
+eg: powershell
"[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\"root:TimechoDB@2021\"))"
```
-- 若用户名密码认证失败,则返回如下信息:
+2. 鉴权示例
- HTTP 状态码:`401`
+默认用户名 `root`,密码 `TimechoDB@2021`:
- 返回结构体如下
- ```json
- {
- "code": 600,
- "message": "WRONG_LOGIN_PASSWORD_ERROR"
- }
- ```
+* 拼接字符串:`root:TimechoDB@2021`
+* Base64 编码后为:`cm9vdDpUaW1lY2hvREJAMjAyMQ==`
+* 最终 Header:
-- 若未设置 `Authorization`,则返回如下信息:
+```JSON
+Authorization: Basic cm9vdDpUaW1lY2hvREJAMjAyMQ==
+```
- HTTP 状态码:`401`
+3. 错误说明
+* 用户名/密码错误:返回 HTTP 状态码 `600`,内容:
- 返回结构体如下
- ```json
- {
- "code": 603,
- "message": "UNINITIALIZED_AUTH_ERROR"
- }
- ```
+```JSON
+{"code":600,"message":"WRONG_LOGIN_PASSWORD_ERROR"}
+```
+
+* 未设置 `Authorization`:返回 HTTP 状态码 `603`,内容:
+
+```JSON
+{"code":603,"message":"UNINITIALIZED_AUTH_ERROR"}
+```
## 3. 接口