From c0a7793da2ce8446aa298db845a344082c6b9db9 Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Mon, 18 Jul 2022 16:29:15 +0800 Subject: [PATCH 1/4] add workflow api --- docs-2.0/nebula-explorer/12.query-visually.md | 2 +- .../graph-explorer/13.choose-graphspace.md | 2 +- .../workflow/workflow-api/api-cancel-job.md | 62 +++++++++ .../workflow/workflow-api/api-desc-job.md | 88 ++++++++++++ .../workflow/workflow-api/api-desc-task.md | 82 +++++++++++ .../workflow/workflow-api/api-get-jobs.md | 107 +++++++++++++++ .../workflow-api/api-get-workflow-jobs.md | 100 ++++++++++++++ .../workflow/workflow-api/api-post-jobs.md | 75 +++++++++++ .../workflow-api/workflow-api-overview.md | 127 ++++++++++++++++++ 9 files changed, 643 insertions(+), 2 deletions(-) create mode 100644 docs-2.0/nebula-explorer/workflow/workflow-api/api-cancel-job.md create mode 100644 docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-job.md create mode 100644 docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-task.md create mode 100644 docs-2.0/nebula-explorer/workflow/workflow-api/api-get-jobs.md create mode 100644 docs-2.0/nebula-explorer/workflow/workflow-api/api-get-workflow-jobs.md create mode 100644 docs-2.0/nebula-explorer/workflow/workflow-api/api-post-jobs.md create mode 100644 docs-2.0/nebula-explorer/workflow/workflow-api/workflow-api-overview.md diff --git a/docs-2.0/nebula-explorer/12.query-visually.md b/docs-2.0/nebula-explorer/12.query-visually.md index d81fcc3ae4a..d2e55e71b9f 100644 --- a/docs-2.0/nebula-explorer/12.query-visually.md +++ b/docs-2.0/nebula-explorer/12.query-visually.md @@ -18,7 +18,7 @@ The Visual Query feature uses a visual representation to express related request ## Page elements -![visual_overview](https://docs-cdn.nebula-graph.com.cn/figures/visual-query-beta_2022-04-15_15-40-07_en.png) +![visual_overview](https://docs-cdn.nebula-graph.com.cn/figures/visual-query-20220718-en.png) At the top of the Explorer page, click **Visual Query** to enter the visual query page. On the left side of the **Visual Query** page, all the Tag(s) corresponding to the graph space (e.g.player and team) and the Tag named **Any Tag** are displayed. You can query vertices without tags by the Tag named **Any Tag**. diff --git a/docs-2.0/nebula-explorer/graph-explorer/13.choose-graphspace.md b/docs-2.0/nebula-explorer/graph-explorer/13.choose-graphspace.md index 3464d56aeaf..b4f46fc690a 100644 --- a/docs-2.0/nebula-explorer/graph-explorer/13.choose-graphspace.md +++ b/docs-2.0/nebula-explorer/graph-explorer/13.choose-graphspace.md @@ -10,7 +10,7 @@ You have connected to Explorer. For details, see [Connect to Explorer](../deploy After connecting to Explorer, the system automatically displays the graph space selection page. You only need to select the target graph space. -![Create_graphspace](https://docs-cdn.nebula-graph.com.cn/figures/create-graphspace_en.png) +![Create_graphspace](https://docs-cdn.nebula-graph.com.cn/figures/select-space-220718-en.png) If you want to select a graph space again, follow the below steps to choose one. diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/api-cancel-job.md b/docs-2.0/nebula-explorer/workflow/workflow-api/api-cancel-job.md new file mode 100644 index 00000000000..e295c260ad3 --- /dev/null +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/api-cancel-job.md @@ -0,0 +1,62 @@ +# Cancel the running of a job + +This topic describes how to use API to cancel the running of a job. + +## API path + +`api-open/v1/jobs//cancel` + +``: The job ID. See request parameters below. + +## Request parameters + +### Path parameters + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`job_id`|number|yes|-|`1964`|The job ID. It can be queried through the API [Get a list of all jobs](api-get-jobs.md) or viewed on the job list page.| + +### Headers parameters + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`Content-Type`|string|yes|-|`application/x-www-form-urlencoded`|The content type.| +|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| + +### Body parameters + +None. + +### Request example + +```bash +curl -i -X PUT -H "Content-Type: application/x-www-form-urlencoded" -H "Cookie: "explorer_token=eyJhbxxx"" http://192.168.8.145:7002/api-open/v1/jobs/30600/cancel +``` + +## Response parameters + +|Parameters|Type|Example|Description| +|:---|:---|:---|:---| +|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return the error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | +|`message` | string | `Success` | The result information of the execution. | +|`data` | object | - | The list of returned data. | +|    - `success` | bool | `true` | Whether the job was canceled successfully.| + +### Response example + +```http +{ + "cookie": [], + "Content-Type": "application/json", + "Traceparent": "00-8b4b47413a211d9b5e0839aadc712052-4a98bae37fe5948a-00", + "Date": "Mon, 18 Jul 2022 01:45:08 GMT", + "Content-Length": "54" +} +{ + "code": 0, + "data": { + "success": true + }, + "message": "Success" +} +``` \ No newline at end of file diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-job.md b/docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-job.md new file mode 100644 index 00000000000..768594f2edf --- /dev/null +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-job.md @@ -0,0 +1,88 @@ +# Query details for a specified job + +This topic describes how to use API to query details for a specified job. + +## API path + +`api-open/v1/jobs/` + +``: The job ID. See request parameters below. + +## Request parameters + +### Path parameters + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`job_id`|number|yes|-|`1964`| The job ID. It can be queried through the API [Get a list of all jobs](api-get-jobs.md) or viewed on the job list page.| + +### Headers parameters + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`Content-Type`|string|yes|-|`application/json`|The content type.| +|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| + +### Body parameters + +None. + +### Request example + +```bash +curl -i -X GET -H "Content-Type: application/json" -H "Cookie: "explorer_token=eyJhbxxx"" http://192.168.8.145:7002/api-open/v1/jobs/1964 +``` + +## Response parameters + +|Parameters|Type|Example|Description| +|:---|:---|:---|:---| +|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return the error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | +|`message` | string | `Success` | The result information of the execution. | +|`data` | object | - | The list of returned data. | +|    - `id` | number | `1964` | The job ID.| +|    - `name` | string | `workflow_xkkjf_20220712103332` | The job name. | +|    - `workflowId` | string | `3992429968` | The workflow ID. | +|    - `workflowName` | string | `workflow_xkkjf` | The workflow name. | +|    - `status` | number | `2` | The job status code. For details, see [Workflow API overview](workflow-api-overview.md). | +|    - `tasks` | object | -| The task details. | +|       - `id` | string | `f93dea90fc3a11ecac7e6da0662c195b`| The task ID. | +|       - `name` | string | `BFS`| The task name. | +|       - `runBeginTime` | datetime | `2022-07-12T10:33:35+08:00` | The start time of the task execution. | +|       - `runEndTime` | datetime | `2022-07-12T10:33:38+08:00` | The end time of the task execution. | +|       - `status` | number | `2` | The task status code. For details, see [Workflow API overview](workflow-api-overview.md). | + +### Response example + +```http +{ + "cookie": [], + "Content-Type": "application/json", + "Traceparent": "00-3db17c9fd9e0a4c3824973471523d214-4384705e523dce83-00", + "Date": "Fri, 15 Jul 2022 09:08:20 GMT", + "Content-Length": "400" +} +{ + "code": 0, + "data": { + "id": 1964, + "name": "workflow_xkkjf_20220712103332", + "workflowId": "3992429968", + "workflowName": "workflow_xkkjf", + "status": 2, + "tasks": [ + { + "id": "f93dea90fc3a11ecac7e6da0662c195b", + "name": "BFS", + "runBeginTime": "2022-07-12T10:33:35+08:00", + "runEndTime": "2022-07-12T10:33:38+08:00", + "status": 2 + } + ], + "runBeginTime": 1657593215000, + "runEndTime": 1657593218000, + "createTime": 1657593212505 + }, + "message": "Success" +} +``` \ No newline at end of file diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-task.md b/docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-task.md new file mode 100644 index 00000000000..9ed6dfb8163 --- /dev/null +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-task.md @@ -0,0 +1,82 @@ +# Get the result data of a specified task + +This topic describes how to use API to get the result data of a specified task. + +## API path + +`api-open/v1/jobs//tasks//sample_result` + +- ``: The job ID. See request parameters below. + +- ``: The task ID. See request parameters below. + +## Request parameters + +### Path parameters + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`job_id`|number|yes|-|`29987`| The job ID. It can be queried through the API [Get a list of all jobs](api-get-jobs.md) or viewed on the job list page.| +|`task_id`|number|yes|-|`8c171f70fb6f11ecac7e6da0662c195b`|The task ID. It can be queried through the API [Query details for a specified job](api-desc-job.md) or viewed in the upper right corner of the specified job page by clicking the component.| + +### Headers parameters + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`Content-Type`|string|yes|-|`application/x-www-form-urlencoded`|The content type.| +|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| + +### Body parameters + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`limit`|number|yes|`10`|-| Limit the number of rows to return results.| + +### Request example + +```bash +curl -i -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Cookie: "explorer_token=eyJhbxxx"" http://192.168.8.145:7002/api-open/v1/jobs/29987/tasks/8c171f70fb6f11ecac7e6da0662c195b/sample_result?limit=1000 +``` + +## Response parameters + +|Parameters|Type|Example|Description| +|:---|:---|:---|:---| +|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return the error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | +|`message` | string | `Success` | The result information of the execution. | +|`data` | object | - | The list of returned data. | +|    - `items`|list|-| The list of detailed results.| +|       - `result` | string | `"player110","0.150000"` | Depending on the algorithm, the result could be 2 or 3 columns.| + +### Response example + +```http +{ + "cookie": [], + "Content-Type": "application/json", + "Traceparent": "00-14047b04b6810be06be22e010f500506-4c310a844b824a7f-00", + "Date": "Fri, 15 Jul 2022 09:36:56 GMT", + "Content-Length": "2014" +} +{ + "code": 0, + "data": { + "items": [ + [ + "player110", + "0.150000" + ], + [ + "team219", + "0.452126" + ], + ...... + [ + "player121", + "0.262148" + ] + ] + }, + "message": "Success" +} +``` diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/api-get-jobs.md b/docs-2.0/nebula-explorer/workflow/workflow-api/api-get-jobs.md new file mode 100644 index 00000000000..0bea186ba96 --- /dev/null +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/api-get-jobs.md @@ -0,0 +1,107 @@ +# Get a list of all jobs + +This topic describes how to use API to get a list of all jobs. + +## API path + +`api-open/v1/jobs` + +## Request parameters + +### Path parameters + +None. + +### Headers parameters + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`Content-Type`|string|yes|-|`application/json`|The content type.| +|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| + +### Body parameters + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`filter` | object| no|-|-| The filter settings.| +|   - `name` |string |no |-|`workflow_q745a_20220715092236`| The job name. | +|   - `status` |number |no |-|`2`| The job status code. For details, see [Workflow API overview](workflow-api-overview.md).| +|   - `fromCreateTime` | number| no|-|`1657848036000`| Start time stamp. Filtering based on the job creation time.| +|   - `toCreateTime` |number |no |-|`1657848157000`| End time stamp. Filtering based on the job creation time.| +|   - `orderByCreateTime` | string| no|`desc`|-| Sorting mode. The available value are `desc` and `asc`. | +|`pageSize` |number |no| `10`| -| The number of entries to return on each page.| +|`page` |number |no| `1`| -| The number of the page to return.| + +### Request example + +!!! note + + The content after `jobs?` is the body parameter, and the content of `filter` is the result of URL encoding. The original content of `filter` was `{ "status": 2, "orderByCreateTime": "asc"}`. + +```bash +curl -i -X GET -H "Content-Type: application/json" -H "Cookie: "explorer_token=eyJhbxxx"" http://192.168.8.145:7002/api-open/v1/jobs?filter=%7B%20%22status%22%3A%202%2C%20%20%22orderByCreateTime%22%3A%20%22asc%22%7D&pageSize=10&page=1 +``` + +## Response parameters + +|Parameters|Type|Example|Description| +|:---|:---|:---|:---| +|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return the error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | +|`message` | string | `Success` | The result information of the execution. | +|`data` | object | - | The list of returned data. | +|   - `total` | number | `2` |The total number of records. | +|   - `Page` | number | `1` | The number of the page to return. | +|   - `PageSize` | number | `10` | The number of entries to return on each page. | +|   - `items` | object | - | The list of record details. | +|       - `id` | number | `105` | The job ID. | +|       - `name` | string | `workflow_q745a_20220715090915` | The job name. | +|       - `workflowId` | string | `4216617528` | The workflow ID. | +|       - `workflowName` | string | `workflow_q745a` | The workflow name. | +|       - `status` | number | `2` | The job status code. For details, see [Workflow API overview](workflow-api-overview.md). | +|       - `runBeginTime` | number | `1657847358000` | The start time of the job execution. | +|       - `runEndTime` | number | `1657847364000` | The end time of the job execution. | +|       - `createTime` | number | `1657847355906` | The creation time of the job. | + +### Response example + +```http +{ + "cookie": [], + "Content-Type": "application/json", + "Traceparent": "00-d3a1943f5baf46771e9afc629e0b5d40-920db2f06142f5ff-00", + "Date": "Fri, 15 Jul 2022 06:17:21 GMT", + "Content-Length": "512" +} + +{ + "code": 0, + "data": { + "items": [ + { + "id": 105, + "name": "workflow_q745a_20220715090915", + "workflowId": "4216617528", + "workflowName": "workflow_q745a", + "status": 2, + "runBeginTime": 1657847358000, + "runEndTime": 1657847364000, + "createTime": 1657847355906 + }, + { + "id": 106, + "name": "workflow_q745a_20220715092236", + "workflowId": "4216617528", + "workflowName": "workflow_q745a", + "status": 2, + "runBeginTime": 1657848157000, + "runEndTime": 1657848163000, + "createTime": 1657848156290 + } + ], + "total": 2, + "Page": 1, + "PageSize": 10 + }, + "message": "Success" +} +``` \ No newline at end of file diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/api-get-workflow-jobs.md b/docs-2.0/nebula-explorer/workflow/workflow-api/api-get-workflow-jobs.md new file mode 100644 index 00000000000..7597e21c769 --- /dev/null +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/api-get-workflow-jobs.md @@ -0,0 +1,100 @@ +# Get a list of jobs for a specified workflow + +This topic describes how to use API to get the list of jobs for a specified workflow. + +## API path + +`api-open/v1/workflows//jobs` + +``: The workflow ID. See request parameters below. + +## Request parameters + +### Path parameters + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`workflow_id`|number|yes|-|`4216617528`|The workflow ID. The system instantiates a specified workflow as a job. The ID can be viewed in the upper left corner of the specified workflow page.| + +### Headers parameters + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`Content-Type`|string|yes|-|`application/json`|The content type.| +|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| + +### Body parameters + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`filter` | object| no|-|-| The filter settings.| +|   - `name` |string |no |-|`workflow_q745a_20220715092236`| The job name. | +|   - `status` |number |no |-|`2`| The job status code. For details, see [Workflow API overview](workflow-api-overview.md).| +|   - `fromCreateTime` | number| no|-|`1657848036000`| Start time stamp. Filtering based on the job creation time.| +|   - `toCreateTime` |number |no |-|`1657848157000`| End time stamp. Filtering based on the job creation time.| +|   - `orderByCreateTime` | string| no|`desc`|-| Sorting mode. The available value are `desc` and `asc`. | +|`pageSize` |number |no| `10`| -| The number of entries to return on each page.| +|`page` |number |no| `1`| -| The number of the page to return.| + +### Request example + +!!! note + + The content after `jobs?` is the body parameter, and the content of `filter` is the result of URL encoding. The original content of `filter` was `{"status": 2, "fromCreateTime": 1657874100000}`. + +```bash +curl -i -X GET -H "Content-Type: application/json" -H "Cookie: "explorer_token=eyJhbxxx"" http://192.168.8.145:7002/api-open/v1/workflows/4216617528/jobs?filter=%7B%22status%22%3A%202%2C%20%20%22fromCreateTime%22%3A%201657874100000%7D&pageSize=10&page=1 +``` + +## Response parameters + +|Parameters|Type|Example|Description| +|:---|:---|:---|:---| +|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return the error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | +|`message` | string | `Success` | The result information of the execution. | +|`data` | object | - | The list of returned data. | +|   - `total` | number | `2` |The total number of records. | +|   - `Page` | number | `1` | The number of the page to return. | +|   - `PageSize` | number | `10` | The number of entries to return on each page. | +|   - `items` | object | - | The list of record details. | +|       - `id` | number | `105` | The job ID.| +|       - `name` | string | `workflow_q745a_20220715090915` | The job name. | +|       - `workflowId` | string | `4216617528` | The workflow ID. | +|       - `workflowName` | string | `workflow_q745a` | The workflow name. | +|       - `status` | number | `2` | The job status code. For details, see [Workflow API overview](workflow-api-overview.md). | +|       - `runBeginTime` | number | `1657847358000` | The start time of the job execution. | +|       - `runEndTime` | number | `1657847364000` | The end time of the job execution. | +|       - `createTime` | number | `1657847355906` | The creation time of the job. | + +### Response example + +```http +{ + "cookie": [], + "Content-Type": "application/json", + "Traceparent": "00-008c3056686dd3f3be38b8eda42a917e-b5616e30434cb803-00", + "Date": "Fri, 15 Jul 2022 08:44:06 GMT", + "Content-Length": "297" +} +{ + "code": 0, + "data": { + "items": [ + { + "id": 115, + "name": "workflow_q745a_20220715163650", + "workflowId": "4216617528", + "workflowName": "workflow_q745a", + "status": 2, + "runBeginTime": 1657874212000, + "runEndTime": 1657874218000, + "createTime": 1657874210088 + } + ], + "total": 1, + "Page": 1, + "PageSize": 10 + }, + "message": "Success" +} +``` diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/api-post-jobs.md b/docs-2.0/nebula-explorer/workflow/workflow-api/api-post-jobs.md new file mode 100644 index 00000000000..f9eb66b270e --- /dev/null +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/api-post-jobs.md @@ -0,0 +1,75 @@ +# Add a new job + +This topic describes how to use API to add a new job. + +## API path + +`api-open/v1/workflows//jobs` + +``: The workflow ID. See request parameters below. + +## Request parameters + +### Path parameters + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`workflow_id`|number|yes|-|`4216617528`| The workflow ID. The system instantiates a specified workflow as a job. The ID can be viewed in the upper left corner of the specified workflow page.| + +### Headers parameters + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`Content-Type`|string|yes|-|`application/json`| The content type.| +|`explorer_token`|string|yes|-|`eyJhbxxx`| The authorization token that used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| + +### Body parameters + +!!! note + + Users must ensure the rationality and correctness of the user-defined input parameters. Otherwise, the operation will fail. + +|Parameters|Type|If required|Default value|Example| Description| +|:---|:---|:---|:---|:---|:---| +|`input`|object|no|-|-| The user-defined input parameters.| +|   - `task_id`|object|no|-|`query_1`|The task ID. Users can view the ID in the upper right corner of the component settings page. A task can set multiple parameters represented by key-value pairs. | +|      - `param_name: param_value`|string: {string or number}|no|-|`param0: player100`|`param_name` is the parameter key, that is, the parameter name. `param_value` is the parameter value.| + +### Request example + +The following is an example of using the user-defined input parameter `name` in an nGQL statement. Pass in the parameter value `Tim Duncan` when creating a job. + +![api-postjob](https://docs-cdn.nebula-graph.com.cn/figures/api-postjob-220715-en.png) + +```bash +curl -i -X POST -H "Content-Type: application/json" -H "Cookie: "explorer_token=eyJhbxxx"" -d '{"input":{"query_1":{"name":"Tim Duncan"}}}' http://192.168.8.145:7002/api-open/v1/workflows/4216617528/jobs +``` + +## Response parameters + +|Parameters|Type|Example|Description| +|:---|:---|:---|:---| +|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return the error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | +|`message` | string | `Success` | The result information of the execution. | +|`data` | object | - | The list of returned data. | +|   - `id`|string|`107`| The ID of the new job.| + +### Response example + +```http +{ + "cookie": [], + "Content-Type": "application/json", + "Traceparent": "00-1ba128615cdc2226c921973a689e9f1b-7630b12963494672-00", + "Date": "Fri, 15 Jul 2022 07:19:25 GMT", + "Content-Length": "48" +} + +{ + "code": 0, + "data": { + "id": 107 + }, + "message": "Success" +} +``` diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/workflow-api-overview.md b/docs-2.0/nebula-explorer/workflow/workflow-api/workflow-api-overview.md new file mode 100644 index 00000000000..49aeb7a8e5d --- /dev/null +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/workflow-api-overview.md @@ -0,0 +1,127 @@ +# Workflow API overview + +Nebula Explorer provides some APIs for using workflow. + +The supported APIs are as follows: + +- [Add a new job](api-post-jobs.md) +- [Get a list of all jobs](api-get-jobs.md) +- [Get a list of jobs for a specified workflow](api-get-workflow-jobs.md) +- [Query details for a specified job](api-desc-job.md) +- [Cancel the running of a job](api-cancel-job.md) +- [Get the result data of a specified task](api-desc-task.md) + +## Request method + +Users can use curl to call APIs to achieve corresponding functions. + +The format is as follows: + +```bash +curl http://:/?{} +``` + +- ``: Curl supports a large number of options. The most commonly used options for workflow are `-X`, `-H` and `-d`. For more information about options, see [curl official documentation](https://curl.se/docs/manpage.html). + +- ``: The access address of the Nebula Explorer. + +- ``: The access port of the Nebula Explorer. + +- ``: The call path of APIs. For example: `api-open/v1/jobs`. + +- ``: The body parameters that needs to be supplied when calling APIs. + +## Get authorization token + +Token information verification is required when calling an API. Run the following command to get the authorization token. + +```bash +curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer " -d '{"address":"","port":}' http://:/api-open/v1/connect +``` + +- ``: The Base64 encoded Nebula Graph account and password. Before the encoding, the format is `:`, for example, `root:123`. After the encoding, the result is `cm9vdDoxMjM=`. +- ``: The access address of the Nebula Graph. +- ``: The access port of the Nebula Graph. +- ``: The access address of the Nebula Explorer. +- ``: The access port of the Nebula Explorer. + +Example: + +```bash +curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer cm9vdDoxMjM=" -d '{"address":"192.168.8.111","port":9669}' http://192.168.8.145:7002/api-open/v1/connect +``` + +Response: + +```http +HTTP/1.1 200 OK +Content-Type: application/json +Set-Cookie: explorer_token=eyJhbxxx; Path=/; # Max-Age=259200; HttpOnly +Traceparent: 00-1c3f55cdbf81e13a2331ed88155ce0bf-2b97474943563f20-# 00 +Date: Thu, 14 Jul 2022 06:47:01 GMT +Content-Length: 54 + +{ + "code": 0, + "data": { + "success": true + }, + "message": "Success" +} +``` + +Note the following parameters: + +- `explorer_token`: The authorization token. + +- `Max-Age`: Token validity time. Unit: second. The default value is 259,200 seconds, that is 3 days. You can change the default validity time in the `config/app-config.yaml` file in the installation directory. + +## Response + +- If an API is called successfully, the system returns the following information: + + ```http + { + code: 0, + message: 'Success', + data: //Return the results based on the API. + } + ``` + +- If an API is called failed, the system returns the corresponding common error code. For example: + + ```http + { + code: 40004000, + message: '', //Display the error information. + } + ``` + + For descriptions of common error codes, see the following sections. + +### Common error codes + +|Error code|Information|Description| +|:---|:---|:---| +|40004000 | `ErrBadRequest` | Request error. | +|40004001 | `ErrParam` | Request parameter error. | +|40104000 | `ErrUnauthorized` | Request authorization error. | +|40104001 | `ErrSession` | Login session error. | +|40304000 | `ErrForbidden` | Request denied. | +|40404000 | `ErrNotFound` | Requested resource does not exist. | +|50004000 | `ErrInternalServer` | Internal service error. | +|50004001 | `ErrInternalDatabase` | Database error. | +|50004002 | `ErrInternalController` | Controller error. | +|50004003 | `ErrInternalLicense` | Certificate verification error. | +|90004000 | `ErrUnknown` | Unknown error. | + +### Job/Task status code + +|Status code|Description| +|:---|:---| +|0 | Preparing| +|1 | Running| +|2 | Success| +|3 | Failed| +|4 | Interrupted| +|5 | Stopping| From 55ba41ed58f2fe57a8a108f60d2382ff6d719a26 Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Mon, 18 Jul 2022 16:56:47 +0800 Subject: [PATCH 2/4] update --- .../nebula-explorer/workflow/workflow-api/api-cancel-job.md | 4 ++-- .../workflow/workflow-api/workflow-api-overview.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/api-cancel-job.md b/docs-2.0/nebula-explorer/workflow/workflow-api/api-cancel-job.md index e295c260ad3..f502f835a48 100644 --- a/docs-2.0/nebula-explorer/workflow/workflow-api/api-cancel-job.md +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/api-cancel-job.md @@ -1,6 +1,6 @@ -# Cancel the running of a job +# Cancel a running job -This topic describes how to use API to cancel the running of a job. +This topic describes how to use API to cancel a running job. ## API path diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/workflow-api-overview.md b/docs-2.0/nebula-explorer/workflow/workflow-api/workflow-api-overview.md index 49aeb7a8e5d..8c88c657c3e 100644 --- a/docs-2.0/nebula-explorer/workflow/workflow-api/workflow-api-overview.md +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/workflow-api-overview.md @@ -8,7 +8,7 @@ The supported APIs are as follows: - [Get a list of all jobs](api-get-jobs.md) - [Get a list of jobs for a specified workflow](api-get-workflow-jobs.md) - [Query details for a specified job](api-desc-job.md) -- [Cancel the running of a job](api-cancel-job.md) +- [Cancel a running job](api-cancel-job.md) - [Get the result data of a specified task](api-desc-task.md) ## Request method From 18a1baaa3c8df61dc52e83308b05e3255a86fc6e Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Tue, 19 Jul 2022 10:35:42 +0800 Subject: [PATCH 3/4] update --- .../nebula-explorer/workflow/workflow-api/api-cancel-job.md | 6 +++--- .../nebula-explorer/workflow/workflow-api/api-desc-job.md | 6 +++--- .../nebula-explorer/workflow/workflow-api/api-desc-task.md | 6 +++--- .../nebula-explorer/workflow/workflow-api/api-get-jobs.md | 6 +++--- .../workflow/workflow-api/api-get-workflow-jobs.md | 6 +++--- .../nebula-explorer/workflow/workflow-api/api-post-jobs.md | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/api-cancel-job.md b/docs-2.0/nebula-explorer/workflow/workflow-api/api-cancel-job.md index f502f835a48..8760a0e9a9f 100644 --- a/docs-2.0/nebula-explorer/workflow/workflow-api/api-cancel-job.md +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/api-cancel-job.md @@ -1,6 +1,6 @@ # Cancel a running job -This topic describes how to use API to cancel a running job. +This topic describes how to use an API to cancel a running job. ## API path @@ -21,7 +21,7 @@ This topic describes how to use API to cancel a running job. |Parameters|Type|If required|Default value|Example| Description| |:---|:---|:---|:---|:---|:---| |`Content-Type`|string|yes|-|`application/x-www-form-urlencoded`|The content type.| -|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| +|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that is used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| ### Body parameters @@ -37,7 +37,7 @@ curl -i -X PUT -H "Content-Type: application/x-www-form-urlencoded" -H "Cookie: |Parameters|Type|Example|Description| |:---|:---|:---|:---| -|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return the error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | +|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return an error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | |`message` | string | `Success` | The result information of the execution. | |`data` | object | - | The list of returned data. | |    - `success` | bool | `true` | Whether the job was canceled successfully.| diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-job.md b/docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-job.md index 768594f2edf..1e9b08a8f58 100644 --- a/docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-job.md +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-job.md @@ -1,6 +1,6 @@ # Query details for a specified job -This topic describes how to use API to query details for a specified job. +This topic describes how to use an API to query details for a specified job. ## API path @@ -21,7 +21,7 @@ This topic describes how to use API to query details for a specified job. |Parameters|Type|If required|Default value|Example| Description| |:---|:---|:---|:---|:---|:---| |`Content-Type`|string|yes|-|`application/json`|The content type.| -|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| +|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that is used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| ### Body parameters @@ -37,7 +37,7 @@ curl -i -X GET -H "Content-Type: application/json" -H "Cookie: "explorer_token=e |Parameters|Type|Example|Description| |:---|:---|:---|:---| -|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return the error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | +|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return an error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | |`message` | string | `Success` | The result information of the execution. | |`data` | object | - | The list of returned data. | |    - `id` | number | `1964` | The job ID.| diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-task.md b/docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-task.md index 9ed6dfb8163..44c473da5bc 100644 --- a/docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-task.md +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/api-desc-task.md @@ -1,6 +1,6 @@ # Get the result data of a specified task -This topic describes how to use API to get the result data of a specified task. +This topic describes how to use an API to get the result data of a specified task. ## API path @@ -24,7 +24,7 @@ This topic describes how to use API to get the result data of a specified task. |Parameters|Type|If required|Default value|Example| Description| |:---|:---|:---|:---|:---|:---| |`Content-Type`|string|yes|-|`application/x-www-form-urlencoded`|The content type.| -|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| +|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that is used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| ### Body parameters @@ -42,7 +42,7 @@ curl -i -X GET -H "Content-Type: application/x-www-form-urlencoded" -H "Cookie: |Parameters|Type|Example|Description| |:---|:---|:---|:---| -|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return the error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | +|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return an error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | |`message` | string | `Success` | The result information of the execution. | |`data` | object | - | The list of returned data. | |    - `items`|list|-| The list of detailed results.| diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/api-get-jobs.md b/docs-2.0/nebula-explorer/workflow/workflow-api/api-get-jobs.md index 0bea186ba96..77037134453 100644 --- a/docs-2.0/nebula-explorer/workflow/workflow-api/api-get-jobs.md +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/api-get-jobs.md @@ -1,6 +1,6 @@ # Get a list of all jobs -This topic describes how to use API to get a list of all jobs. +This topic describes how to use an API to get a list of all jobs. ## API path @@ -17,7 +17,7 @@ None. |Parameters|Type|If required|Default value|Example| Description| |:---|:---|:---|:---|:---|:---| |`Content-Type`|string|yes|-|`application/json`|The content type.| -|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| +|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that is used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| ### Body parameters @@ -46,7 +46,7 @@ curl -i -X GET -H "Content-Type: application/json" -H "Cookie: "explorer_token=e |Parameters|Type|Example|Description| |:---|:---|:---|:---| -|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return the error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | +|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return an error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | |`message` | string | `Success` | The result information of the execution. | |`data` | object | - | The list of returned data. | |   - `total` | number | `2` |The total number of records. | diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/api-get-workflow-jobs.md b/docs-2.0/nebula-explorer/workflow/workflow-api/api-get-workflow-jobs.md index 7597e21c769..e1fe5c45cc9 100644 --- a/docs-2.0/nebula-explorer/workflow/workflow-api/api-get-workflow-jobs.md +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/api-get-workflow-jobs.md @@ -1,6 +1,6 @@ # Get a list of jobs for a specified workflow -This topic describes how to use API to get the list of jobs for a specified workflow. +This topic describes how to use an API to get the list of jobs for a specified workflow. ## API path @@ -21,7 +21,7 @@ This topic describes how to use API to get the list of jobs for a specified work |Parameters|Type|If required|Default value|Example| Description| |:---|:---|:---|:---|:---|:---| |`Content-Type`|string|yes|-|`application/json`|The content type.| -|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| +|`explorer_token`|string|yes|-|`eyJhbxxx`|The authorization token that is used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| ### Body parameters @@ -50,7 +50,7 @@ curl -i -X GET -H "Content-Type: application/json" -H "Cookie: "explorer_token=e |Parameters|Type|Example|Description| |:---|:---|:---|:---| -|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return the error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | +|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return an error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | |`message` | string | `Success` | The result information of the execution. | |`data` | object | - | The list of returned data. | |   - `total` | number | `2` |The total number of records. | diff --git a/docs-2.0/nebula-explorer/workflow/workflow-api/api-post-jobs.md b/docs-2.0/nebula-explorer/workflow/workflow-api/api-post-jobs.md index f9eb66b270e..04b561324b0 100644 --- a/docs-2.0/nebula-explorer/workflow/workflow-api/api-post-jobs.md +++ b/docs-2.0/nebula-explorer/workflow/workflow-api/api-post-jobs.md @@ -1,6 +1,6 @@ # Add a new job -This topic describes how to use API to add a new job. +This topic describes how to use an API to add a new job. ## API path @@ -21,7 +21,7 @@ This topic describes how to use API to add a new job. |Parameters|Type|If required|Default value|Example| Description| |:---|:---|:---|:---|:---|:---| |`Content-Type`|string|yes|-|`application/json`| The content type.| -|`explorer_token`|string|yes|-|`eyJhbxxx`| The authorization token that used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| +|`explorer_token`|string|yes|-|`eyJhbxxx`| The authorization token that is used to verify account information. For details, see [Workflow API overview](workflow-api-overview.md).| ### Body parameters @@ -49,7 +49,7 @@ curl -i -X POST -H "Content-Type: application/json" -H "Cookie: "explorer_token= |Parameters|Type|Example|Description| |:---|:---|:---|:---| -|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return the error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | +|`code` | number | `0` | The result code of the request. Return `0` if the request is successful, and return an error code if the request is unsuccessful. For details, see [Workflow API overview](workflow-api-overview.md). | |`message` | string | `Success` | The result information of the execution. | |`data` | object | - | The list of returned data. | |   - `id`|string|`107`| The ID of the new job.| From 53628610e605bdade65865dc313889180361966a Mon Sep 17 00:00:00 2001 From: cooper-lzy <78672629+cooper-lzy@users.noreply.github.com> Date: Tue, 19 Jul 2022 10:43:50 +0800 Subject: [PATCH 4/4] update --- mkdocs.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index 5ff8f4dd48f..1676cc1b0ca 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -590,12 +590,20 @@ nav: - Canvas overview: nebula-explorer/canvas-operations/canvas-overview.md - Visualization modes: nebula-explorer/canvas-operations/visualization-mode.md - Canvas snapshots: nebula-explorer/canvas-operations/canvas-snapshot.md -# - Workflow: -# - Workflow overview: nebula-explorer/workflow/workflows.md -# - Resource preparations: nebula-explorer/workflow/1.prepare-resources.md -# - Workflow example: nebula-explorer/workflow/2.create-workflow.md -# - Workflow management: nebula-explorer/workflow/3.workflow-management.md -# - Job management: nebula-explorer/workflow/4.jobs-management.md + - Workflow: + - Workflow overview: nebula-explorer/workflow/workflows.md + - Resource preparations: nebula-explorer/workflow/1.prepare-resources.md + - Workflow example: nebula-explorer/workflow/2.create-workflow.md + - Workflow management: nebula-explorer/workflow/3.workflow-management.md + - Job management: nebula-explorer/workflow/4.jobs-management.md + - Workflow API: + - Add a new job: nebula-explorer/workflow/workflow-api/api-post-jobs.md + - Get a list of all jobs: nebula-explorer/workflow/workflow-api/api-get-jobs.md + - Get a list of jobs for a specified workflow: nebula-explorer/workflow/workflow-api/api-get-workflow-jobs.md + - Query details for a specified job: nebula-explorer/workflow/workflow-api/api-desc-job.md + - Cancel a running job: nebula-explorer/workflow/workflow-api/api-cancel-job.md + - Get the result data of a specified task: nebula-explorer/workflow/workflow-api/api-desc-task.md + - Basic operations and shortcuts: nebula-explorer/ex-ug-shortcuts.md - Nebula Importer: