diff --git a/docs/docs/en/guide/open-api.md b/docs/docs/en/guide/open-api.md index 1bac59b494..656fb415b4 100644 --- a/docs/docs/en/guide/open-api.md +++ b/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. -

- -

+![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". -

- -

+![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 -

- -

- 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 ``` -

- -

+ +![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": -

- -

+This demonstrates how to use the calling api to create the corresponding project. -

- -

+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) -

- -

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 -

- -

+![api-source01](/img/new_ui/dev/open-api/api_source01.png) + +![api-source02](/img/new_ui/dev/open-api/api_source02.png) -

- -

diff --git a/docs/docs/zh/guide/open-api.md b/docs/docs/zh/guide/open-api.md index c334358136..cd01d22868 100644 --- a/docs/docs/zh/guide/open-api.md +++ b/docs/docs/zh/guide/open-api.md @@ -1,65 +1,67 @@ # API 调用 ## 背景 -一般都是通过页面来创建项目、流程等,但是与第三方系统集成就需要通过调用 API 来管理项目、流程 + +一般都是通过页面来创建项目、流程等,但是与第三方系统集成就需要通过调用 API 来管理项目、流程。 ## 操作步骤 ### 创建 token -1. 登录调度系统,点击 "安全中心",再点击左侧的 "令牌管理",点击 "令牌管理" 创建令牌 +1. 登录调度系统,点击 "安全中心",再点击左侧的 "令牌管理",点击 "令牌管理" 创建令牌。 -

- -

+![create-token](/img/new_ui/dev/security/create-token.png) -2. 选择 "失效时间" (Token有效期),选择 "用户" (以指定的用户执行接口操作),点击 "生成令牌" ,拷贝 Token 字符串,然后点击 "提交" -

- -

- -### 使用 Token -1. 打开 API文档页面 - > 地址:http://{api server ip}:12345/dolphinscheduler/doc.html?language=zh_CN&lang=cn -

- -

+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 ``` -

- -

- -### 创建项目 -这里以创建名为 "wudl-flink-test" 的项目为例 -

- -

- -

- -

+ +![api-test](/img/new_ui/dev/open-api/api_test.png) -

- -

+#### 创建项目 + +这里演示如何使用调用 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 的方式创建了项目。 如果您对创建项目的源码感兴趣,欢迎继续阅读下面内容 + ### 附:创建项目源码 -

- -

+![api-source01](/img/new_ui/dev/open-api/api_source01.png) -

- -

+![api-source02](/img/new_ui/dev/open-api/api_source02.png) diff --git a/docs/img/api/create_project1.png b/docs/img/api/create_project1.png deleted file mode 100644 index 156ea3e00a..0000000000 Binary files a/docs/img/api/create_project1.png and /dev/null differ diff --git a/docs/img/api/create_project2.png b/docs/img/api/create_project2.png deleted file mode 100644 index ea9e678904..0000000000 Binary files a/docs/img/api/create_project2.png and /dev/null differ diff --git a/docs/img/api/create_project3.png b/docs/img/api/create_project3.png deleted file mode 100644 index c78487ef84..0000000000 Binary files a/docs/img/api/create_project3.png and /dev/null differ diff --git a/docs/img/api/create_source1.png b/docs/img/api/create_source1.png deleted file mode 100644 index 614b548758..0000000000 Binary files a/docs/img/api/create_source1.png and /dev/null differ diff --git a/docs/img/api/create_source2.png b/docs/img/api/create_source2.png deleted file mode 100644 index 130e7cccfc..0000000000 Binary files a/docs/img/api/create_source2.png and /dev/null differ diff --git a/docs/img/new_ui/dev/open-api/api_doc.png b/docs/img/new_ui/dev/open-api/api_doc.png new file mode 100644 index 0000000000..2666d8b99b Binary files /dev/null and b/docs/img/new_ui/dev/open-api/api_doc.png differ diff --git a/docs/img/new_ui/dev/open-api/api_source01.png b/docs/img/new_ui/dev/open-api/api_source01.png new file mode 100644 index 0000000000..2148f166f4 Binary files /dev/null and b/docs/img/new_ui/dev/open-api/api_source01.png differ diff --git a/docs/img/new_ui/dev/open-api/api_source02.png b/docs/img/new_ui/dev/open-api/api_source02.png new file mode 100644 index 0000000000..70edbb1a48 Binary files /dev/null and b/docs/img/new_ui/dev/open-api/api_source02.png differ diff --git a/docs/img/new_ui/dev/open-api/api_test.png b/docs/img/new_ui/dev/open-api/api_test.png new file mode 100644 index 0000000000..32c885bc6e Binary files /dev/null and b/docs/img/new_ui/dev/open-api/api_test.png differ diff --git a/docs/img/new_ui/dev/open-api/create_project01.png b/docs/img/new_ui/dev/open-api/create_project01.png new file mode 100644 index 0000000000..c03f1102db Binary files /dev/null and b/docs/img/new_ui/dev/open-api/create_project01.png differ diff --git a/docs/img/new_ui/dev/open-api/create_project02.png b/docs/img/new_ui/dev/open-api/create_project02.png new file mode 100644 index 0000000000..61a26ac072 Binary files /dev/null and b/docs/img/new_ui/dev/open-api/create_project02.png differ diff --git a/docs/img/new_ui/dev/open-api/create_project03.png b/docs/img/new_ui/dev/open-api/create_project03.png new file mode 100644 index 0000000000..732e240203 Binary files /dev/null and b/docs/img/new_ui/dev/open-api/create_project03.png differ diff --git a/docs/img/new_ui/dev/open-api/token_expiration.png b/docs/img/new_ui/dev/open-api/token_expiration.png new file mode 100644 index 0000000000..9a75cad5a2 Binary files /dev/null and b/docs/img/new_ui/dev/open-api/token_expiration.png differ