跳转到内容

Minion API

3 endpoints.

GEThttp://localhost:3000/api/minion/{jobid}

给定 Minion 任务 ID,检查它是成功还是失败。
Minion 任务用于缩略图、缓存预热、处理新进来的文件等各种场合。
对部分任务,你可以查看 notes 字段获取进度信息。详见 https://docs.mojolicious.org/Minion/Guide#Job-progress 。

路径参数

jobidinteger必填
要查询状态的任务 ID。

响应

200任务状态数据
{
  "error": null,
  "notes": {
    "example_note": "This note could contain the name of the upload, for example."
  },
  "state": "finished",
  "task": "handle_upload"
}

填写你自己的实例地址,请求由浏览器直接发往该地址。

GEThttp://localhost:3000/api/minion/{jobid}/detail

获取一个 Minion 任务的状态。
这个 API 主要供内部使用,但你可以用它来获取插件执行、URL 下载这类任务的详细状态。

路径参数

jobidinteger必填

响应

200任务详情
{
  "args": [
    "/tmp/QF3UCnKdMr/myfile.zip"
  ],
  "attempts": 1,
  "children": [],
  "created": 1601145004,
  "delayed": 1601145004,
  "expires": null,
  "finished": 1601145004,
  "id": 7,
  "lax": 0,
  "notes": {},
  "parents": [],
  "priority": 0,
  "queue": "default",
  "result": {
    "id": "75d18ce470dc99f83dc355bdad66319d1f33c82b",
    "message": "This file already exists in the Library.",
    "success": 0
  },
  "retried": null,
  "retries": 0,
  "started": 1601145004,
  "state": "finished",
  "task": "handle_upload",
  "time": 1601145005,
  "worker": 1
}

填写你自己的实例地址,请求由浏览器直接发往该地址。

POSThttp://localhost:3000/api/minion/{jobname}/queue

按指定的类型和参数排入一个任务。
可用的任务类型及各自所需参数见 LANraragi::Utils::Minion 。

对于某个任务类型在给定服务端版本上是否存在,并没有 API 契约,所以除非你有充分理由,否则不建议使用它。

路径参数

jobnamestring · enum: thumbnail_task | tank_thumbnail_task | page_thumbnails | regen_all_thumbnails | find_duplicates | build_stat_hashes | handle_upload | download_url | run_plugin必填
要实例化的任务类型。

查询参数

argsstring必填
参数,以 JSON 数组字符串给出
priorityinteger · default: 0可选
Minion 任务的优先级。数字越大越优先。

响应

200已入队的任务
{
  "job": 0,
  "operation": "",
  "success": 1
}

该端点需要管理员令牌:访客(只读)令牌会被服务端拒绝。

填写你自己的实例地址,请求由浏览器直接发往该地址。