[Bug][doc] Fix the open-api docs request error (#10100)
|
|
@ -10,60 +10,59 @@ Generally, projects and processes are created through pages, but considering the
|
|||
|
||||
1. Log in to the scheduling system, click "Security", then click "Token manage" on the left, and click "Create token" to create a token.
|
||||
|
||||
<p align="center">
|
||||
<img src="/img/token-management-en.png" width="80%" />
|
||||
</p>
|
||||

|
||||
|
||||
2. Select the "Expiration time" (Token validity time), select "User" (choose the specified user to perform the API operation), click "Generate token", copy the `Token` string, and click "Submit".
|
||||
|
||||
<p align="center">
|
||||
<img src="/img/create-token-en1.png" width="80%" />
|
||||
</p>
|
||||

|
||||
|
||||
### Token Usage
|
||||
### Examples
|
||||
|
||||
#### Query project list
|
||||
|
||||
1. Open the API documentation
|
||||
|
||||
> Address:http://{API server ip}:12345/dolphinscheduler/doc.html?language=en_US&lang=en
|
||||
|
||||

|
||||
|
||||
1. Open the API documentation page
|
||||
> Address:http://{API server ip}:12345/dolphinscheduler/doc.html?language=en_US&lang=en
|
||||
<p align="center">
|
||||
<img src="/img/api-documentation-en.png" width="80%" />
|
||||
</p>
|
||||
|
||||
2. select a test API, the API selected for this test is `queryAllProjectList`
|
||||
> projects/query-project-list
|
||||
|
||||
> projects/list
|
||||
>
|
||||
3. Open `Postman`, fill in the API address, enter the `Token` in `Headers`, and then send the request to view the result:
|
||||
```
|
||||
|
||||
```
|
||||
token: The Token just generated
|
||||
```
|
||||
<p align="center">
|
||||
<img src="/img/test-api.png" width="80%" />
|
||||
</p>
|
||||
|
||||

|
||||
|
||||
### Create a Project
|
||||
#### Create a Project
|
||||
|
||||
Here is an example of creating a project named "wudl-flink-test":
|
||||
<p align="center">
|
||||
<img src="/img/api/create_project1.png" width="80%" />
|
||||
</p>
|
||||
This demonstrates how to use the calling api to create the corresponding project.
|
||||
|
||||
<p align="center">
|
||||
<img src="/img/api/create_project2.png" width="80%" />
|
||||
</p>
|
||||
By consulting the api documentation, configure the KEY as Accept and VALUE as the parameter of application/json in the headers of Postman.
|
||||
|
||||

|
||||
|
||||
And then configure the required projectName and description parameters in Body.
|
||||
|
||||

|
||||
|
||||
Check the post request result.
|
||||
|
||||

|
||||
|
||||
<p align="center">
|
||||
<img src="/img/api/create_project3.png" width="80%" />
|
||||
</p>
|
||||
The returned `msg` information is "success", indicating that we have successfully created the project through API.
|
||||
|
||||
If you are interested in the source code of creating a project, please continue to read the following:
|
||||
|
||||
### Appendix: The Source Code of Creating a Project
|
||||
|
||||
<p align="center">
|
||||
<img src="/img/api/create_source1.png" width="80%" />
|
||||
</p>
|
||||

|
||||
|
||||

|
||||
|
||||
<p align="center">
|
||||
<img src="/img/api/create_source2.png" width="80%" />
|
||||
</p>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,65 +1,67 @@
|
|||
# API 调用
|
||||
|
||||
## 背景
|
||||
一般都是通过页面来创建项目、流程等,但是与第三方系统集成就需要通过调用 API 来管理项目、流程
|
||||
|
||||
一般都是通过页面来创建项目、流程等,但是与第三方系统集成就需要通过调用 API 来管理项目、流程。
|
||||
|
||||
## 操作步骤
|
||||
|
||||
### 创建 token
|
||||
|
||||
1. 登录调度系统,点击 "安全中心",再点击左侧的 "令牌管理",点击 "令牌管理" 创建令牌
|
||||
1. 登录调度系统,点击 "安全中心",再点击左侧的 "令牌管理",点击 "令牌管理" 创建令牌。
|
||||
|
||||
<p align="center">
|
||||
<img src="/img/token-management.png" width="80%" />
|
||||
</p>
|
||||

|
||||
|
||||
2. 选择 "失效时间" (Token有效期),选择 "用户" (以指定的用户执行接口操作),点击 "生成令牌" ,拷贝 Token 字符串,然后点击 "提交"
|
||||
<p align="center">
|
||||
<img src="/img/create-token.png" width="80%" />
|
||||
</p>
|
||||
2. 选择 "失效时间" (Token 有效期),选择 "用户" (以指定的用户执行接口操作),点击 "生成令牌" ,拷贝 Token 字符串,然后点击 "提交" 。
|
||||
|
||||
### 使用 Token
|
||||
1. 打开 API文档页面
|
||||
> 地址:http://{api server ip}:12345/dolphinscheduler/doc.html?language=zh_CN&lang=cn
|
||||
<p align="center">
|
||||
<img src="/img/api-documentation.png" width="80%" />
|
||||
</p>
|
||||

|
||||
|
||||
### 使用案例
|
||||
|
||||
#### 查询项目列表信息
|
||||
|
||||
1. 打开 API 文档页面
|
||||
|
||||
> 地址:http://{api server ip}:12345/dolphinscheduler/doc.html?language=zh_CN&lang=cn
|
||||
|
||||

|
||||
|
||||
2. 选一个测试的接口,本次测试选取的接口是:查询所有项目
|
||||
> projects/query-project-list
|
||||
|
||||
> projects/list
|
||||
|
||||
3. 打开 Postman,填写接口地址,并在 Headers 中填写 Token,发送请求后即可查看结果
|
||||
```
|
||||
token:刚刚生成的Token
|
||||
```
|
||||
<p align="center">
|
||||
<img src="/img/test-api.png" width="80%" />
|
||||
</p>
|
||||
|
||||
### 创建项目
|
||||
这里以创建名为 "wudl-flink-test" 的项目为例
|
||||
<p align="center">
|
||||
<img src="/img/api/create_project1.png" width="80%" />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="/img/api/create_project2.png" width="80%" />
|
||||
</p>
|
||||
```
|
||||
token: 刚刚生成的 Token
|
||||
```
|
||||
|
||||

|
||||
|
||||
<p align="center">
|
||||
<img src="/img/api/create_project3.png" width="80%" />
|
||||
</p>
|
||||
#### 创建项目
|
||||
|
||||
这里演示如何使用调用 api 来创建对应的项目。
|
||||
|
||||
通过查阅 api 文档,在 Postman 的 Headers 中配置 KEY 为 Accept,VALUE 为 application/json 的参数。
|
||||
|
||||

|
||||
|
||||
然后再 Body 中配置所需的 projectName 和 description 参数。
|
||||
|
||||

|
||||
|
||||
检查 post 请求结果。
|
||||
|
||||

|
||||
|
||||
返回 msg 信息为 "success",说明我们已经成功通过 API 的方式创建了项目。
|
||||
|
||||
如果您对创建项目的源码感兴趣,欢迎继续阅读下面内容
|
||||
|
||||
### 附:创建项目源码
|
||||
|
||||
<p align="center">
|
||||
<img src="/img/api/create_source1.png" width="80%" />
|
||||
</p>
|
||||

|
||||
|
||||
<p align="center">
|
||||
<img src="/img/api/create_source2.png" width="80%" />
|
||||
</p>
|
||||

|
||||
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 352 KiB |
|
Before Width: | Height: | Size: 272 KiB |
|
After Width: | Height: | Size: 206 KiB |
|
After Width: | Height: | Size: 252 KiB |
|
After Width: | Height: | Size: 228 KiB |
|
After Width: | Height: | Size: 177 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 255 KiB |