跳转至

获取预热任务列表

1. 接口描述

接口请求路径:POST /prod-api/acdn/tcdn/content/describePushTasks

describePushTasks 用于分页查询指定域名下的 URL 预热任务列表。URL / 目录刷新历史请使用 describeContentTasks。查询预热任务时 purgeType 可为空。查询域名须属于当前账号。

Token 获取方式见 密钥鉴权

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数

参数名称 必选 类型 描述
domain String 加速域名,须属于当前账号
示例值:lw111.ruisuyun.com
pageNum Integer 当前页数
示例值:1
pageSize Integer 每页显示条目个数
示例值:10
params Object 时间筛选条件
params.beginTime String 开始时间,格式 yyyy-MM-dd HH:mm:ss
示例值:2025-10-15 00:00:00
params.endTime String 结束时间,格式 yyyy-MM-dd HH:mm:ss
示例值:2025-10-15 23:59:59
purgeType String 查询类型。查询预热任务时可传空字符串
searchHeader Object 筛选条件
searchHeader.status String 任务状态,支持以下值:
done:完成
process:预热中
fail:失败
invalid:预热无效(源站返回 4xx/5xx)
示例值:done

3. 示例

示例1 查询预热任务

输入示例

{
  "domain": "lw111.ruisuyun.com",
  "pageNum": 1,
  "pageSize": 10,
  "params": {
    "beginTime": "2025-10-15 00:00:00",
    "endTime": "2025-10-15 23:59:59"
  },
  "purgeType": "",
  "searchHeader": {}
}

代码调用

请将 {登录域名}token 替换为实际值。

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class DescribePushTasksTest {

    public static void main(String[] args) throws Exception {
        String url = "https://{登录域名}/prod-api/acdn/tcdn/content/describePushTasks";
        String token = "eyJhbGciOiJIUzUxMiJ9.xxxxxx";

        String requestBody = "{"
                + "\"domain\":\"lw111.ruisuyun.com\","
                + "\"pageNum\":1,"
                + "\"pageSize\":10,"
                + "\"params\":{\"beginTime\":\"2025-10-15 00:00:00\",\"endTime\":\"2025-10-15 23:59:59\"},"
                + "\"purgeType\":\"\","
                + "\"searchHeader\":{}"
                + "}";

        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
            HttpPost httpPost = new HttpPost(url);
            httpPost.setHeader("Authorization", "Bearer " + token);
            httpPost.setEntity(new StringEntity(requestBody, ContentType.APPLICATION_JSON));

            try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
                int statusCode = response.getStatusLine().getStatusCode();
                String body = EntityUtils.toString(response.getEntity(), "UTF-8");
                System.out.println("Status Code: " + statusCode);
                System.out.println("Body: " + body);
            }
        }
    }
}
package main

import (
    "bytes"
    "fmt"
    "io"
    "net/http"
)

func main() {
    url := "https://{登录域名}/prod-api/acdn/tcdn/content/describePushTasks"
    token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"

    requestBody := []byte(`{
  "domain": "lw111.ruisuyun.com",
  "pageNum": 1,
  "pageSize": 10,
  "params": {
    "beginTime": "2025-10-15 00:00:00",
    "endTime": "2025-10-15 23:59:59"
  },
  "purgeType": "",
  "searchHeader": {}
}`)

    req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(requestBody))
    if err != nil {
        panic(err)
    }
    req.Header.Set("Authorization", "Bearer "+token)
    req.Header.Set("Content-Type", "application/json")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }
    fmt.Println("Status Code:", resp.StatusCode)
    fmt.Println("Body:", string(body))
}

输出示例

{
  "total": 1,
  "rows": [
    {
      "taskId": "153303185323131331",
      "url": "http://www.test.com/test.html",
      "status": "done",
      "percent": 100,
      "createTime": "2025-10-15 18:10:53",
      "area": "mainland",
      "updateTime": "2025-10-15 18:11:20"
    }
  ],
  "code": 200,
  "msg": "success"
}

4. 输出参数

参数名称 类型 描述
code Integer 状态码。示例值:200
msg String 提示信息。示例值:success
total Integer 任务总条数。示例值:1
rows Array 当前页预热任务列表
rows[].taskId String 预热任务 ID。示例值:153303185323131331
rows[].url String 预热的 URL。示例值:http://www.test.com/test.html
rows[].status String 任务状态,支持以下值:
done:完成
process:预热中
fail:失败
invalid:预热无效(源站返回 4xx/5xx)
示例值:done
rows[].percent Integer 预热进度百分比。示例值:100
rows[].createTime String 任务提交时间。示例值:2025-10-15 18:10:53
rows[].area String 预热地域,支持以下值:
mainland:中国境内
overseas:中国境外
global:全球
示例值:mainland
rows[].updateTime String 任务更新时间,可能为 null。示例值:2025-10-15 18:11:20

5. 错误码

HTTP 状态码 / 业务提示 描述
200 成功
401 未鉴权或 Token 无效
403 无权限
域名不属于你 指定域名未接入或不属于当前账号
域名不能为空 未传入 domain