跳转至

查询资源包列表

1. 接口描述

接口请求路径:POST /prod-api/multiCdn/open/agent/resource/describeResource

describeResource 用于分页查询指定客户、指定区域下尚未删除的 CDN 2.0 资源包。结果按开始时间倒序。

本接口不使用 密钥鉴权 的 Bearer Token。请在请求头携带平台分配的 agent-codeagent-api-key。请用客户的 emailphone 定位账号,服务端只返回该账号且属于当前代理商的资源包。获取方式见 自有平台接入一键登录

创建、删除见 创建资源包删除资源包

注意emailphone 至少填写一项。两项都填时必须指向同一客户。pageNumpageSize 默认值分别为 110

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。本接口请使用 agent-codeagent-api-key,不要携带 Bearer Token。

参数名称 必选 类型 描述
agent-code String Header 参数。代理商唯一码。开通时由平台分配,总后台代理商列表 AgentCode 列可查看。示例值:{agent-code}
agent-api-key String Header 参数。代理商 API 密钥。在总后台该代理商的 代理商账号 页签单击 查看 获取。示例值:{agent-api-key}
email String 客户邮箱。与 phone 至少填一项。示例值:user@example.com
phone String 客户手机号。与 email 至少填一项。示例值:13800138000
region String 加速区域。取值:chinese_mainland(中国大陆)、outside_chinese_mainland(中国大陆以外)、global(全球)、indonesia(印度尼西亚)。示例值:chinese_mainland
pageNum Integer 当前页数。默认值:1。示例值:1
pageSize Integer 每页条数。默认值:10。示例值:10
filters [SearchFilter] 关键字筛选。label 仅允许 packageName,否则返回「复杂查询条件不存在」。
searchHeader.status String 资源包状态,单值精确匹配。取值:ACTIVE(有效)、EXPIRED(已过期)、SUSPENDED(已暂停)、EXHAUSTED(已用完)。示例值:ACTIVE

3. 输出参数

参数名称 类型 描述
code Integer 状态码。示例值:200
msg String 提示信息。示例值:成功
total Integer 符合条件的总条数。示例值:2
rows Array of Object 当前页资源包列表。
rows[].id String 资源包 ID。示例值:1001
rows[].ownerUid String 所属客户用户 ID。示例值:279
rows[].packageName String 资源包名称。示例值:100GB
rows[].totalTrafficBytes String 总流量,单位字节。示例值:100000000000
rows[].remainingTrafficBytes String 剩余流量,单位字节。示例值:80000000000
rows[].usedTrafficBytes String 已用流量,单位字节。示例值:20000000000
rows[].totalRequests String 总请求数。示例值:500000
rows[].remainingRequests String 剩余请求数。示例值:400000
rows[].usedRequests String 已用请求数。示例值:100000
rows[].priority String 抵扣优先级。示例值:1
rows[].region String 加速区域。取值同输入 region。示例值:chinese_mainland
rows[].status String 资源包状态。取值:ACTIVE(有效)、EXPIRED(已过期)、SUSPENDED(已暂停)、EXHAUSTED(已用完)。示例值:ACTIVE
rows[].startTime String 生效时间,格式 yyyy-MM-dd HH:mm:ss。示例值:2026-01-01 00:00:00
rows[].endTime String 到期时间,格式 yyyy-MM-dd HH:mm:ss。示例值:2026-07-01 00:00:00

4. 示例

示例1 按邮箱查询中国大陆资源包

输入示例

{
  "email": "user@example.com",
  "region": "chinese_mainland",
  "pageNum": 1,
  "pageSize": 10
}

代码调用

请将 {登录域名}{agent-code}{agent-api-key} 替换为实际值。

curl -X POST 'https://{登录域名}/prod-api/multiCdn/open/agent/resource/describeResource' \
  -H 'agent-code: {agent-code}' \
  -H 'agent-api-key: {agent-api-key}' \
  -H 'Content-Type: application/json' \
  -d '{
  "email": "user@example.com",
  "region": "chinese_mainland",
  "pageNum": 1,
  "pageSize": 10
}'
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 DescribeResourceTest {

    public static void main(String[] args) throws Exception {
        String url = "https://{登录域名}/prod-api/multiCdn/open/agent/resource/describeResource";

        String requestBody = "{"
                + "\"email\":\"user@example.com\","
                + "\"region\":\"chinese_mainland\","
                + "\"pageNum\":1,"
                + "\"pageSize\":10"
                + "}";

        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
            HttpPost httpPost = new HttpPost(url);
            httpPost.setHeader("agent-code", "{agent-code}");
            httpPost.setHeader("agent-api-key", "{agent-api-key}");
            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/multiCdn/open/agent/resource/describeResource"

    requestBody := []byte(`{
  "email": "user@example.com",
  "region": "chinese_mainland",
  "pageNum": 1,
  "pageSize": 10
}`)

    req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(requestBody))
    if err != nil {
        panic(err)
    }
    req.Header.Set("agent-code", "{agent-code}")
    req.Header.Set("agent-api-key", "{agent-api-key}")
    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": [
    {
      "id": "1001",
      "ownerUid": "279",
      "packageName": "100GB",
      "totalTrafficBytes": "100000000000",
      "remainingTrafficBytes": "80000000000",
      "usedTrafficBytes": "20000000000",
      "totalRequests": "500000",
      "remainingRequests": "400000",
      "usedRequests": "100000",
      "priority": "1",
      "region": "chinese_mainland",
      "status": "ACTIVE",
      "startTime": "2026-01-01 00:00:00",
      "endTime": "2026-07-01 00:00:00"
    }
  ],
  "code": 200,
  "msg": "成功"
}

示例2 按资源包名称与状态筛选

输入示例

{
  "phone": "13800138000",
  "region": "chinese_mainland",
  "pageNum": 1,
  "pageSize": 10,
  "filters": [
    {
      "label": "packageName",
      "value": ["100GB"]
    }
  ],
  "searchHeader": {
    "status": "ACTIVE"
  }
}

代码调用

请将 {登录域名}{agent-code}{agent-api-key} 替换为实际值。

curl -X POST 'https://{登录域名}/prod-api/multiCdn/open/agent/resource/describeResource' \
  -H 'agent-code: {agent-code}' \
  -H 'agent-api-key: {agent-api-key}' \
  -H 'Content-Type: application/json' \
  -d '{
  "phone": "13800138000",
  "region": "chinese_mainland",
  "pageNum": 1,
  "pageSize": 10,
  "filters": [
    {
      "label": "packageName",
      "value": ["100GB"]
    }
  ],
  "searchHeader": {
    "status": "ACTIVE"
  }
}'
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 DescribeResourceFilterTest {

    public static void main(String[] args) throws Exception {
        String url = "https://{登录域名}/prod-api/multiCdn/open/agent/resource/describeResource";

        String requestBody = "{"
                + "\"phone\":\"13800138000\","
                + "\"region\":\"chinese_mainland\","
                + "\"pageNum\":1,"
                + "\"pageSize\":10,"
                + "\"filters\":[{\"label\":\"packageName\",\"value\":[\"100GB\"]}],"
                + "\"searchHeader\":{\"status\":\"ACTIVE\"}"
                + "}";

        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
            HttpPost httpPost = new HttpPost(url);
            httpPost.setHeader("agent-code", "{agent-code}");
            httpPost.setHeader("agent-api-key", "{agent-api-key}");
            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/multiCdn/open/agent/resource/describeResource"

    requestBody := []byte(`{
  "phone": "13800138000",
  "region": "chinese_mainland",
  "pageNum": 1,
  "pageSize": 10,
  "filters": [
    {
      "label": "packageName",
      "value": ["100GB"]
    }
  ],
  "searchHeader": {
    "status": "ACTIVE"
  }
}`)

    req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(requestBody))
    if err != nil {
        panic(err)
    }
    req.Header.Set("agent-code", "{agent-code}")
    req.Header.Set("agent-api-key", "{agent-api-key}")
    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": [
    {
      "id": "1001",
      "ownerUid": "279",
      "packageName": "100GB",
      "totalTrafficBytes": "100000000000",
      "remainingTrafficBytes": "80000000000",
      "usedTrafficBytes": "20000000000",
      "totalRequests": "500000",
      "remainingRequests": "400000",
      "usedRequests": "100000",
      "priority": "1",
      "region": "chinese_mainland",
      "status": "ACTIVE",
      "startTime": "2026-01-01 00:00:00",
      "endTime": "2026-07-01 00:00:00"
    }
  ],
  "code": 200,
  "msg": "成功"
}

5. 错误码

HTTP 状态码 / 业务提示 描述
200 成功
401 未鉴权或 Token 无效
403 无权限
agent-code不能为空 未传请求头 agent-code
agent-api-key不能为空 未传请求头 agent-api-key
鉴权失败:无效的agent-code或agent-api-key 请求头中的代理商编号或 API 密钥不正确
区域不能为空 未传 region
客户邮箱和手机号不能同时为空 emailphone 都未填写
无效的邮箱或手机号 客户不属于当前代理商,或邮箱与手机号不是同一账号
复杂查询条件不存在:[xxx] filters.label 不是 packageNamexxx 为传入的字段名

6. 数据模型

SearchFilter

关键字筛选条件。value 仅 1 个元素时按模糊匹配(LIKE),多个元素时按精确匹配(IN)。

参数名称 必选 类型 描述
label String 筛选字段。取值:packageName(资源包名称)。示例值:packageName
value Array of String 筛选值。单值模糊匹配,多值精确匹配。示例值:["100GB"]