列出Tasks
列出调度器的任务,已计划和运行中的任务分别分页。
身份验证
此端点为公开,无需身份验证。
路径参数
| 参数 |
类型 |
描述 |
| id |
string |
调度器的唯一标识符 |
查询参数
| 参数 |
类型 |
描述 |
| scheduled_page |
integer |
已计划任务的页码(默认:1) |
| scheduled_per_page |
integer |
已计划任务每页条数(默认:20) |
| inflight_page |
integer |
运行中任务的页码(默认:1) |
| inflight_per_page |
integer |
运行中任务每页条数(默认:20) |
| search |
string |
按负载内容搜索任务 |
| label |
string |
按标签过滤(格式:key:value) |
请求示例
curl "https://api.hola.cloud/schedulers/sched-a1b2c3d4-e5f6-7890-abcd-ef1234567890/tasks?label=priority:high"
GET /schedulers/sched-a1b2c3d4-e5f6-7890-abcd-ef1234567890/tasks?label=priority:high HTTP/1.1
Host: api.hola.cloud
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://api.hola.cloud/schedulers/sched-a1b2c3d4-e5f6-7890-abcd-ef1234567890/tasks?label=priority:high", nil)
if err != nil {
panic(err)
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(responseBody))
}
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.hola.cloud/schedulers/sched-a1b2c3d4-e5f6-7890-abcd-ef1234567890/tasks?label=priority:high',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
]);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch));
}
curl_close($ch);
echo $response;
import requests
response = requests.request(
"GET",
"https://api.hola.cloud/schedulers/sched-a1b2c3d4-e5f6-7890-abcd-ef1234567890/tasks?label=priority:high"
)
print(response.text)
const response = await fetch("https://api.hola.cloud/schedulers/sched-a1b2c3d4-e5f6-7890-abcd-ef1234567890/tasks?label=priority:high", {
method: "GET"
});
console.log(await response.text());
const response = await fetch("https://api.hola.cloud/schedulers/sched-a1b2c3d4-e5f6-7890-abcd-ef1234567890/tasks?label=priority:high", {
method: "GET"
});
const text = await response.text();
console.log(text);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.hola.cloud/schedulers/sched-a1b2c3d4-e5f6-7890-abcd-ef1234567890/tasks?label=priority:high"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
响应示例
1HTTP/1.1 200 OK
2Content-Type: application/json
1{
2 "scheduled": [
3 {
4 "id": "task-x1y2z3", "future": "2025-06-21T12:01:01Z",
5 "labels": ["project:onboarding", "priority:high"]
6 }
7 ],
8 "inflight": [],
9 "scheduled_meta": { "total": 1, "page": 1, "per_page": 25, "total_pages": 1 },
10 "inflight_meta": { "total": 0, "page": 1, "per_page": 25, "total_pages": 0 }
11}
错误代码
| 状态 |
代码 |
描述 |
| 404 |
not_found |
未找到调度器 |
| 500 |
internal_error |
服务器内部错误 |
评论