Skip to content

Commit

Permalink
docs(task): update docs (#392)
Browse files Browse the repository at this point in the history
* docs(task): update docs

* fix(docs): /api/admin/task move to /api/task

* docs(task): AlistGo/alist#7655

* fix
  • Loading branch information
KirCute authored Jan 10, 2025
1 parent c0a0c91 commit 96a05f9
Show file tree
Hide file tree
Showing 4 changed files with 1,226 additions and 752 deletions.
379 changes: 3 additions & 376 deletions docs/guide/api/admin/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,384 +14,11 @@ tag:
# this page is sticky in article list
sticky: true
# this page will appear in starred articles
star: true
star: false
---

# task

alist中的任务管理可以分为:
本 API 现已移至`/api/task``/api/admin/task`仅出于兼容目的保留

| 接口名 | 说明 |
| --------------- | ------------- |
| /upload | 上传任务 |
| /copy | 复制任务 |
| /aria2_down | aria2下载任务 |
| /aria2_transfer | aria2转存任务 |
| /qbit_down | qbit下载任务 |
| /qbit_transfer | qbit转存任务 |

每种任务都有以下接口:

- info
- done
- undone
- delete
- cancel
- clear_done
- clear_succeeded
- retry

下面将以upload任务为例,说明每个接口的作用。

## POST 获取任务信息

POST /api/admin/task/upload/info

### 请求参数

| 名称 | 位置 | 类型 | 必选 | 说明 |
| ------------- | ------ | ------ | ---- | ------ |
| tid | query | string | no | 任务id |
| Authorization | header | string | yes | none |

### 返回示例

> 成功
```json
{
"code": 200,
"message": "success",
"data": [
{
"id": "1",
"name": "upload 1.png to [/s](/test)",
"state": "succeeded",
"status": "",
"progress": 100,
"error": ""
}
]
}
```

### 返回结果

| 状态码 | 状态码含义 | 说明 | 数据模型 |
| ------ | ------------------------------------------------------- | ---- | -------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | 成功 | Inline |

### 返回数据结构

状态码 **200**

| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
| ----------- | -------- | ----- | ---- | ------------ | ---- |
| » code | integer | true | none | 状态码 | none |
| » message | string | true | none | 信息 | none |
| » data | [object] | true | none | | none |
| »» id | string | false | none | id | none |
| »» name | string | false | none | 任务名 | none |
| »» state | string | false | none | 任务完成状态 | none |
| »» status | string | false | none | | none |
| »» progress | integer | false | none | 进度 | none |
| »» error | string | false | none | 错误信息 | none |

## GET 获取已完成任务

GET /api/admin/task/upload/done

### 请求参数

| 名称 | 位置 | 类型 | 必选 | 说明 |
| ------------- | ------ | ------ | ---- | ---- |
| Authorization | header | string || none |

### 返回示例

> 成功
```json
{
"code": 200,
"message": "success",
"data": [
{
"id": "1",
"name": "upload 1.png to [/s](/test)",
"state": "succeeded",
"status": "",
"progress": 100,
"error": ""
}
]
}
```

### 返回结果

| 状态码 | 状态码含义 | 说明 | 数据模型 |
| ------ | ------------------------------------------------------- | ---- | -------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | 成功 | Inline |

### 返回数据结构

状态码 **200**

| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
| ----------- | -------- | ----- | ---- | ------------ | ---- |
| » code | integer | true | none | 状态码 | none |
| » message | string | true | none | 信息 | none |
| » data | [object] | true | none | | none |
| »» id | string | false | none | id | none |
| »» name | string | false | none | 任务名 | none |
| »» state | string | false | none | 任务完成状态 | none |
| »» status | string | false | none | | none |
| »» progress | integer | false | none | 进度 | none |
| »» error | string | false | none | 错误信息 | none |

## GET 获取未完成任务

GET /api/admin/task/upload/undone

### 请求参数

| 名称 | 位置 | 类型 | 必选 | 说明 |
| ------------- | ------ | ------ | ---- | ---- |
| Authorization | header | string || none |

### 返回示例

> 成功
```json
{
"code": 200,
"message": "success",
"data": [
{
"id": "1",
"name": "upload 1.png to [/s](/test)",
"state": "succeeded",
"status": "",
"progress": 100,
"error": ""
}
]
}
```

### 返回结果

| 状态码 | 状态码含义 | 说明 | 数据模型 |
| ------ | ------------------------------------------------------- | ---- | -------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | 成功 | Inline |

### 返回数据结构

状态码 **200**

| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
| ----------- | -------- | ----- | ---- | ------------ | ---- |
| » code | integer | true | none | 状态码 | none |
| » message | string | true | none | 信息 | none |
| » data | [object] | true | none | | none |
| »» id | string | false | none | id | none |
| »» name | string | false | none | 任务名 | none |
| »» state | string | false | none | 任务完成状态 | none |
| »» status | string | false | none | | none |
| »» progress | integer | false | none | 进度 | none |
| »» error | string | false | none | 错误信息 | none |

## POST 删除任务

POST /api/admin/task/upload/delete

### 请求参数

| 名称 | 位置 | 类型 | 必选 | 说明 |
| ------------- | ------ | ------ | ---- | ------ |
| tid | query | string || 任务id |
| Authorization | header | string || none |

### 返回示例

> 成功
```json
{
"code": 200,
"message": "success",
"data": null
}
```

### 返回结果

| 状态码 | 状态码含义 | 说明 | 数据模型 |
| ------ | ------------------------------------------------------- | ---- | -------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | 成功 | Inline |

### 返回数据结构

状态码 **200**

| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
| --------- | ------- | ---- | ---- | ------ | ---- |
| » code | integer | true | none | 状态码 | none |
| » message | string | true | none | 信息 | none |
| » data | null | true | none | | none |

## POST 取消任务

POST /api/admin/task/upload/cancel

### 请求参数

| 名称 | 位置 | 类型 | 必选 | 说明 |
| ------------- | ------ | ------ | ---- | ------ |
| tid | query | string || 任务id |
| Authorization | header | string || none |

### 返回示例

> 成功
```json
{
"code": 200,
"message": "success",
"data": null
}
```

### 返回结果

| 状态码 | 状态码含义 | 说明 | 数据模型 |
| ------ | ------------------------------------------------------- | ---- | -------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | 成功 | Inline |

### 返回数据结构

状态码 **200**

| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
| --------- | ------- | ---- | ---- | ------ | ---- |
| » code | integer | true | none | 状态码 | none |
| » message | string | true | none | 信息 | none |
| » data | null | true | none | | none |

## POST 清除已完成任务

POST /api/admin/task/upload/clear_done

### 请求参数

| 名称 | 位置 | 类型 | 必选 | 说明 |
| ------------- | ------ | ------ | ---- | ---- |
| Authorization | header | string || none |

### 返回示例

> 成功
```json
{
"code": 200,
"message": "success",
"data": null
}
```

### 返回结果

| 状态码 | 状态码含义 | 说明 | 数据模型 |
| ------ | ------------------------------------------------------- | ---- | -------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | 成功 | Inline |

### 返回数据结构

状态码 **200**

| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
| --------- | ------- | ---- | ---- | ------ | ---- |
| » code | integer | true | none | 状态码 | none |
| » message | string | true | none | 信息 | none |
| » data | null | true | none | | none |

## POST 清除已成功任务

POST /api/admin/task/upload/clear_succeeded

### 请求参数

| 名称 | 位置 | 类型 | 必选 | 说明 |
| ------------- | ------ | ------ | ---- | ---- |
| Authorization | header | string || none |

### 返回示例

> 成功
```json
{
"code": 200,
"message": "success",
"data": null
}
```

### 返回结果

| 状态码 | 状态码含义 | 说明 | 数据模型 |
| ------ | ------------------------------------------------------- | ---- | -------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | 成功 | Inline |

### 返回数据结构

状态码 **200**

| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
| --------- | ------- | ---- | ---- | ------ | ---- |
| » code | integer | true | none | 状态码 | none |
| » message | string | true | none | 信息 | none |
| » data | null | true | none | | none |

## POST 重试任务

POST /api/admin/task/upload/retry

### 请求参数

| 名称 | 位置 | 类型 | 必选 | 说明 |
| ------------- | ------ | ------ | ---- | ------ |
| tid | query | string || 任务id |
| Authorization | header | string || none |

### 返回示例

> 成功
```json
{
"code": 200,
"message": "success",
"data": null
}
```

### 返回结果

| 状态码 | 状态码含义 | 说明 | 数据模型 |
| ------ | ------------------------------------------------------- | ---- | -------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | 成功 | Inline |

### 返回数据结构

状态码 **200**

| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
| --------- | ------- | ---- | ---- | ------ | ---- |
| » code | integer | true | none | 状态码 | none |
| » message | string | true | none | 信息 | none |
| » data | null | true | none | | none |
另见[/api/task](/guide/api/task.html)
Loading

0 comments on commit 96a05f9

Please sign in to comment.