按条件查询 Midjourney 任务
curl --request POST \
--url https://kaienapi.com/mj/task/list-by-condition \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"state": "FAILURE",
"pageNumber": 1,
"pageSize": 20
}
'import requests
url = "https://kaienapi.com/mj/task/list-by-condition"
payload = {
"state": "FAILURE",
"pageNumber": 1,
"pageSize": 20
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({state: 'FAILURE', pageNumber: 1, pageSize: 20})
};
fetch('https://kaienapi.com/mj/task/list-by-condition', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://kaienapi.com/mj/task/list-by-condition"
payload := strings.NewReader("{\n \"state\": \"FAILURE\",\n \"pageNumber\": 1,\n \"pageSize\": 20\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}按条件查询 Midjourney 任务
按条件查询 Midjourney 任务列表。
查询范围
任务管理页、失败任务排查、历史记录分页和批量状态刷新都会用到该接口。
常用筛选
可传状态、页码、分页大小等筛选字段。返回字段以任务对象为准。
读取结果
前端按任务 ID 合并记录,更新状态、进度、结果地址和失败原因。列表页保留分页状态,刷新后避免重复拉取大量任务。
POST
/
mj
/
task
/
list-by-condition
按条件查询 Midjourney 任务
curl --request POST \
--url https://kaienapi.com/mj/task/list-by-condition \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"state": "FAILURE",
"pageNumber": 1,
"pageSize": 20
}
'import requests
url = "https://kaienapi.com/mj/task/list-by-condition"
payload = {
"state": "FAILURE",
"pageNumber": 1,
"pageSize": 20
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({state: 'FAILURE', pageNumber: 1, pageSize: 20})
};
fetch('https://kaienapi.com/mj/task/list-by-condition', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://kaienapi.com/mj/task/list-by-condition"
payload := strings.NewReader("{\n \"state\": \"FAILURE\",\n \"pageNumber\": 1,\n \"pageSize\": 20\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}Authorizations
在请求头中传入:Authorization: Bearer sk-...
Body
application/json
The body is of type object.
Response
成功响应
The response is of type object.
⌘I