查询源站组列表¶
1. 接口描述¶
接口请求路径:POST /prod-api/cdn/layer7/origin/describeOriginGroups
describeOriginGroups 用于分页查询当前账号下的源站组列表,支持按组名、源站地址筛选。
Token 获取方式见 密钥鉴权。
2. 输入参数¶
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| pageNum | 是 | Integer | 当前页数 示例值: 1 |
| pageSize | 是 | Integer | 每页显示条目个数 示例值: 30 |
| filters | 否 | Array | 搜索条件列表 |
| filters.label | 否 | String | 搜索字段。取值:originGroupName(组名)、originRecord(源站地址)示例值: originGroupName |
| filters.value | 否 | Array of String | 搜索值。传入单个值为模糊搜索,多个值为精确搜索 示例值: ["1_1_1_1"] |
3. 示例¶
示例1 分页查询源站组¶
输入示例¶
{
"pageNum": 1,
"pageSize": 30,
"filters": [
{
"label": "originGroupName",
"value": ["1_1_1_1"]
}
]
}
代码调用¶
请将 {登录域名}、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 DescribeOriginGroupsTest {
public static void main(String[] args) throws Exception {
String url = "https://{登录域名}/prod-api/cdn/layer7/origin/describeOriginGroups";
String token = "eyJhbGciOiJIUzUxMiJ9.xxxxxx";
String requestBody = "{"
+ "\"pageNum\":1,"
+ "\"pageSize\":30,"
+ "\"filters\":[{\"label\":\"originGroupName\",\"value\":[\"1_1_1_1\"]}]"
+ "}";
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/cdn/layer7/origin/describeOriginGroups"
token := "eyJhbGciOiJIUzUxMiJ9.xxxxxx"
requestBody := []byte(`{
"pageNum": 1,
"pageSize": 30,
"filters": [
{
"label": "originGroupName",
"value": ["1_1_1_1"]
}
]
}`)
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": 2,
"rows": [
{
"originGroupId": 1338,
"originGroupName": "1_1_1_1",
"updateTime": "2025-10-17 10:41:03",
"originRecords": [
{
"recordId": 1493,
"record": "1.1.1.1",
"weight": null
}
]
},
{
"originGroupId": 1340,
"originGroupName": "1_1_1_1",
"updateTime": "2025-10-11 15:07:12",
"originRecords": [
{
"recordId": 1489,
"record": "1.1.1.1",
"weight": 1
},
{
"recordId": 1490,
"record": "2.2.2.2",
"weight": 3
}
]
}
],
"code": 200,
"msg": "成功"
}
4. 输出参数¶
| 参数名称 | 类型 | 描述 |
|---|---|---|
| code | Integer | 状态码。示例值:200 |
| msg | String | 提示信息。示例值:成功 |
| total | Integer | 源站组总条数。示例值:2 |
| rows | [OriginGroupVO] | 当前页源站组列表 |
5. 错误码¶
| HTTP 状态码 / 业务提示 | 描述 |
|---|---|
| 200 | 成功 |
| 401 | 未鉴权或 Token 无效 |
| 403 | 无权限 |
6. 数据模型¶
OriginGroupVO¶
源站组信息。
| 参数名称 | 类型 | 描述 |
|---|---|---|
| originGroupId | Integer | 源站组 ID。示例值:1338 |
| originGroupName | String | 组名。示例值:1_1_1_1 |
| updateTime | String | 更新时间。示例值:2025-10-17 10:41:03 |
| originRecords | [OriginRecordVO] | 源站记录列表 |
OriginRecordVO¶
源站记录。
| 参数名称 | 类型 | 描述 |
|---|---|---|
| recordId | Integer | 源站记录 ID。示例值:1493 |
| record | String | 源站地址。示例值:1.1.1.1 |
| weight | Integer | 权重,可能为 null。示例值:1 |