跳转至

查询源站组列表

1. 接口描述

接口请求路径:POST /prod-api/multiCdn/origin/describeOriginGroups

describeOriginGroups 用于分页查询当前账号下的源站组,并返回组内源站记录。账号需具备 cdn2:DescribeAllDomains 权限。

Token 获取方式见 密钥鉴权。

说明:按源站地址筛选时,条件会比对请求中的 userId 与源站组所属账号。本接口不会自动写入 userId。

2. 输入参数

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

参数名称 必选 类型 描述
pageNum 是 Integer 当前页数。示例值:1
pageSize 是 Integer 每页显示条目个数。示例值:10
userId 否 Long 仅 filters.label 为 originRecord 时参与筛选,与源站组所属账号比对。示例值:10002
filters 否 Array 搜索条件列表,多个条件为并且关系
filters.label 否 String 搜索字段。取值:originGroupName(源站组名称)、originRecord(源站地址)、ownerUid(所属账号)。示例值:originGroupName
filters.value 否 Array of String 搜索值。originGroupName、ownerUid 在只有 1 个值时模糊搜索,多个值时精确搜索。originRecord 只取第一项做模糊搜索。示例值:["origin-demo"]

3. 输出参数

参数名称 类型 描述
code Integer 状态码。示例值:200
msg String 提示信息。示例值:成功
total Integer 源站组总条数。示例值:1
rows Array 当前页源站组列表
rows[].originGroupGrnId String 源站组 ID。示例值:grn:test:multi-cdn:001:origin/174c12cc214bf7d0020fc48461
rows[].originGroupName String 源站组名称。示例值:origin-demo
rows[].ownerUid Long 所属账号 ID。示例值:10002
rows[].updateTime String 更新时间,格式 yyyy-MM-dd HH:mm:ss。示例值:2025-12-16 10:21:55
rows[].originRecords Array of OriginRecords 源站记录列表

4. 示例

示例1 按源站组名称查询

输入示例

{
  "pageNum": 1,
  "pageSize": 10,
  "filters": [
    {
      "label": "originGroupName",
      "value": ["origin-demo"]
    }
  ]
}

代码调用

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

curl -X POST 'https://{登录域名}/prod-api/multiCdn/origin/describeOriginGroups' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.xxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
  "pageNum": 1,
  "pageSize": 10,
  "filters": [
    {
      "label": "originGroupName",
      "value": ["origin-demo"]
    }
  ]
}'
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 DescribeOriginGroupsTest {

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

        String requestBody = "{"
                + "\"pageNum\":1,"
                + "\"pageSize\":10,"
                + "\"filters\":[{"
                + "\"label\":\"originGroupName\","
                + "\"value\":[\"origin-demo\"]"
                + "}]"
                + "}";

        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/multiCdn/origin/describeOriginGroups"
    token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"

    requestBody := []byte(`{
  "pageNum": 1,
  "pageSize": 10,
  "filters": [
    {
      "label": "originGroupName",
      "value": ["origin-demo"]
    }
  ]
}`)

    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": [
    {
      "originGroupGrnId": "grn:test:multi-cdn:001:origin/174c12cc214bf7d0020fc48461",
      "originGroupName": "origin-demo",
      "ownerUid": 10002,
      "updateTime": "2025-12-16 10:21:55",
      "originRecords": [
        {
          "recordId": "1001",
          "record": "origin.demo.com",
          "weight": 100
        }
      ]
    }
  ],
  "code": 200,
  "msg": "成功"
}

5. 错误码

HTTP 状态码 / 业务提示 描述
200 成功
401 未鉴权或 Token 无效
403 无权限
复杂查询条件不存在:[{0}] filters.label 不是 originGroupName、originRecord、ownerUid。{0} 为传入的字段名

6. 数据模型

OriginRecords

源站组中的一条源站记录。

参数名称 类型 描述
recordId String 源站记录 ID。示例值:1001
record String 源站地址,可为 IPv4 或域名。示例值:origin.demo.com
weight Integer 权重。示例值:100