Browse Source

[Bug][doc] Fix the open-api docs request error (#10100)

(cherry picked from commit 243ee8ba70)
3.0.0/version-upgrade
QuakeWang 3 years ago committed by Jiajie Zhong
parent
commit
418d422bb9
  1. 69
      docs/docs/en/guide/open-api.md
  2. 82
      docs/docs/zh/guide/open-api.md
  3. BIN
      docs/img/api/create_project1.png
  4. BIN
      docs/img/api/create_project2.png
  5. BIN
      docs/img/api/create_project3.png
  6. BIN
      docs/img/api/create_source1.png
  7. BIN
      docs/img/api/create_source2.png
  8. BIN
      docs/img/new_ui/dev/open-api/api_doc.png
  9. BIN
      docs/img/new_ui/dev/open-api/api_source01.png
  10. BIN
      docs/img/new_ui/dev/open-api/api_source02.png
  11. BIN
      docs/img/new_ui/dev/open-api/api_test.png
  12. BIN
      docs/img/new_ui/dev/open-api/create_project01.png
  13. BIN
      docs/img/new_ui/dev/open-api/create_project02.png
  14. BIN
      docs/img/new_ui/dev/open-api/create_project03.png
  15. BIN
      docs/img/new_ui/dev/open-api/token_expiration.png

69
docs/docs/en/guide/open-api.md

@ -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>
![create-token](/img/new_ui/dev/security/create-token.png)
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-expiration](/img/new_ui/dev/open-api/token_expiration.png)
### 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
![api-doc](/img/new_ui/dev/open-api/api_doc.png)
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>
![api-test](/img/new_ui/dev/open-api/api_test.png)
### 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.
![create-project01](/img/new_ui/dev/open-api/create_project01.png)
And then configure the required projectName and description parameters in Body.
![create-project02](/img/new_ui/dev/open-api/create_project02.png)
Check the post request result.
![create-project03](/img/new_ui/dev/open-api/create_project03.png)
<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>
![api-source01](/img/new_ui/dev/open-api/api_source01.png)
![api-source02](/img/new_ui/dev/open-api/api_source02.png)
<p align="center">
<img src="/img/api/create_source2.png" width="80%" />
</p>

82
docs/docs/zh/guide/open-api.md

@ -1,65 +1,67 @@
# API 调用
## 背景
一般都是通过页面来创建项目、流程等,但是与第三方系统集成就需要通过调用 API 来管理项目、流程
一般都是通过页面来创建项目、流程等,但是与第三方系统集成就需要通过调用 API 来管理项目、流程。
## 操作步骤
### 创建 token
1. 登录调度系统,点击 "安全中心",再点击左侧的 "令牌管理",点击 "令牌管理" 创建令牌
1. 登录调度系统,点击 "安全中心",再点击左侧的 "令牌管理",点击 "令牌管理" 创建令牌
<p align="center">
<img src="/img/token-management.png" width="80%" />
</p>
![create-token](/img/new_ui/dev/security/create-token.png)
2. 选择 "失效时间" (Token有效期),选择 "用户" (以指定的用户执行接口操作),点击 "生成令牌" ,拷贝 Token 字符串,然后点击 "提交"
<p align="center">
<img src="/img/create-token.png" width="80%" />
</p>
### 使用 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>
2. 选择 "失效时间" (Token 有效期),选择 "用户" (以指定的用户执行接口操作),点击 "生成令牌" ,拷贝 Token 字符串,然后点击 "提交" 。
![token-expiration](/img/new_ui/dev/open-api/token_expiration.png)
### 使用案例
#### 查询项目列表信息
1. 打开 API 文档页面
> 地址:http://{api server ip}:12345/dolphinscheduler/doc.html?language=zh_CN&lang=cn
![api-doc](/img/new_ui/dev/open-api/api_doc.png)
2. 选一个测试的接口,本次测试选取的接口是:查询所有项目
> projects/query-project-list
> projects/list
3. 打开 Postman,填写接口地址,并在 Headers 中填写 Token,发送请求后即可查看结果
```
token:刚刚生成的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>
![api-test](/img/new_ui/dev/open-api/api_test.png)
<p align="center">
<img src="/img/api/create_project3.png" width="80%" />
</p>
#### 创建项目
这里演示如何使用调用 api 来创建对应的项目。
通过查阅 api 文档,在 Postman 的 Headers 中配置 KEY 为 Accept,VALUE 为 application/json 的参数。
![create-project01](/img/new_ui/dev/open-api/create_project01.png)
然后再 Body 中配置所需的 projectName 和 description 参数。
![create-project02](/img/new_ui/dev/open-api/create_project02.png)
检查 post 请求结果。
![create-project03](/img/new_ui/dev/open-api/create_project03.png)
返回 msg 信息为 "success",说明我们已经成功通过 API 的方式创建了项目。
如果您对创建项目的源码感兴趣,欢迎继续阅读下面内容
### 附:创建项目源码
<p align="center">
<img src="/img/api/create_source1.png" width="80%" />
</p>
![api-source01](/img/new_ui/dev/open-api/api_source01.png)
<p align="center">
<img src="/img/api/create_source2.png" width="80%" />
</p>
![api-source02](/img/new_ui/dev/open-api/api_source02.png)

BIN
docs/img/api/create_project1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

BIN
docs/img/api/create_project2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

BIN
docs/img/api/create_project3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

BIN
docs/img/api/create_source1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 KiB

BIN
docs/img/api/create_source2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 272 KiB

BIN
docs/img/new_ui/dev/open-api/api_doc.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

BIN
docs/img/new_ui/dev/open-api/api_source01.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

BIN
docs/img/new_ui/dev/open-api/api_source02.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

BIN
docs/img/new_ui/dev/open-api/api_test.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

BIN
docs/img/new_ui/dev/open-api/create_project01.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

BIN
docs/img/new_ui/dev/open-api/create_project02.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
docs/img/new_ui/dev/open-api/create_project03.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
docs/img/new_ui/dev/open-api/token_expiration.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

Loading…
Cancel
Save