域名管理相关接口

域名列表查询

查询用户拥有的域名,以列表的形式展示

描述

  • 域名列表查询

URI

GET /cdn/domain/v1/domains/{pageNo}/{pageSize}

请求参数

参数名 位置 必选 类型 说明
domain param string 域名 模糊匹配
cname param string cname 模糊匹配
pageNo path Integer 取得第几页。取值范围:1~100000 默认值:1
pageSize path Integer 分页大小。取值范围:1~50之前的任意整数。最大值:50默认值:20

参数说明

参数名 类型 说明
pageNo Long 返回数据的页码
pageSize Long 整页大小
totalCount String 总条数
data array 内容
└domainId String 域名id
└domain String 域名
└account String 账户
└alias String 用户名
└cname String cname
└deployStatus int 部署状态 0 部署中 1 已部署 2 部署失败 3 初始中 4 停用中 5 删除中
└enableStatus int 0 已停用 1 加速中 2 回源 3 欠费停用(显示为欠费停服) 4 强制停服停用(显示为强制停服)5 强制停用
└verifyStatus int 检查状态 审核状态 0 审核中 1 审核通过 2 审核失败
└domainStatus String 部署中:configuring,部署失败:configure_failed 审核中:checking,审核失败:check_failed,加速中:online,已停用:offline,初始中:initializing,停用中:stopping,删除中:deleting
└serviceType int 服务类型 服务类型 0 图片小文件 1 大文件下载 2 音视频点播
└actions List 域名可执行操作 :start启用、stop停用、delete删除、configure配置
└https int https开关 0 关闭 1 开启
└updatedTime date 修改时间

示例

假设需要获取用户全部域名列表(无筛选条件),且结果分页每页最多20条数据,第1页数据的请求URL为”https://cdn.cn-north-3.inspurcloudapi.com/cdn/domain/v1/domains/1/20“

响应示例

规范请参考响应

{
    "code":"200",
    "message":"查询域名列表成功"
    "data":
    {
        "pageNumber": 1,
        "pageSize": 2,
        "totalCount": 17,
        "data": [
            {
                "domainId": "84933373402808320",
                "domain": "www.baidu.",
                "account": "luanxt",
                "alias": "luanxt",
                "cname": "c31ce4c479a9a08a8684980bb08defe8.cdn.inspurcdn.com",
                "deployStatus": 1,
                "enableStatus": 0,
                "userDomainStatus": 0,
                "verifyStatus": 1,
                "serviceType": 0,
                "https": 0,
                "domainStatus": "offline",
                "updatedTime": "2019-08-23 09:01:43",
                "actions": [
                    "delete",
                    "start"
                ]
            },
            {
                "domainId": "84933558669410304",
                "domain": "www.bai.",
                "account": "luanxt",
                "alias": "luanxt",
                "cname": "88f35355da7329404379880b8c08835c.cdn.inspurcdn.com",
                "deployStatus": 1,
                "enableStatus": 0,
                "userDomainStatus": 0,
                "verifyStatus": 1,
                "serviceType": 0,
                "https": 0,
                "domainStatus": "offline",
                "updatedTime": "2019-08-23 08:59:53",
                "actions": [
                    "delete",
                    "start"
                ]
            }
        ]
    }
}

返回值

请参考通用请求返回值

错误码

以下为本接口特有的错误码。

创建加速域名

描述

  • 创建加速域名

URI

POST /cdn/domain/v1/domains

请求参数

参数名 位置 必选 类型 说明
domain body string 域名
type body uint8 域名类型, 0:普通域名,1:泛域名,2:泛子域名
scope body uint8 服务范围:0:国内,1:海外,2:全球
service body uint8 服务类型:0:web,1:download,2:video,3:dynamic,4:live
config body json 配置信息
└ protocol body uint8 服务协议,0:http,1:https,2:http2
└ probe body string 探测url
└ origin body json 回源配置
└└ protocol body uint8 回源协议,0:跟随,1:http,2:https,3:http2
└└ host body string 回源host
└└ type body uint8 回源类型,0:IP,1:域名
└└ data body json 回源数据
└└└ content body string 回源地址,若└└type为0则为IP,为1则为域名
└└└ port body uint16 回源端口,0为默认,其它为指定
└└└ type body uint8 回源类型,0:无,1:轮循,2:主,3:备
└└└ ratio body uint 回源权重
└└ range body uint 分片回源,0:不分片
└└ limit body uint 回源限速,0:不限速
└└ rule body uint8 回源规则:0:无,1:轮循,2:主备
└└ probe body string 探测url
└ cache body json 缓存配置
└└ ignore body bool 忽略参数
└└type body uint8 缓存类型,0:默认,1:自定义
└└data body json 缓存配置,若type为0则为空
└└└content body string 缓存内容
└└└type body uint8 缓存类型:0:全局,1:首页,2:文件,3:文件夹,4:正则
└└└time body uint 缓存时间
└└└priority body uint8 缓存优先级,数据字越小优先级越高,范围:1〜10
└ https body json https配置, 若└ protocol为1,则必有
└└ cert body string 证书ID
└└ jump body bool 是否强制跳转https,默认不跳转

返回参数

参数名 类型 说明
id String 域名ID
domain String 域名
cname String 浪潮CNAME
createTime String 创建时间 格式yyyy-MM-dd'T'HH-mm-ss'Z'

示例

请求示例 /cdn/domain/v1/domains

{
  "domain": "create07.boxuewenchuang.cn",
  "scope": 0,
  "config": {
    "origin": {
      "type": 0,
      "data": [
        {
          "content": "162.172.8.9"
        }
      ]
    }
  },
  "service": 0
}

请求示例(最全格式) https://cdn.cn-north-3.inspurcloudapi.com/cdn/domain/v1/domains

{
  "domain": "apitest17.boxuewenchuang.cn",
  "scope": 0,
  "version": 1,
  "config": {
    "protocol": 0,
    "origin": {
      "protocol": 0,
      "host": "inspur.boxuewenchuang.com",
      "type": 0,
      "data": [
        {
          "content": "10.10.10.10",
          "port": 80,
          "type": 0,
          "ratio": 10
        }
      ],
      "range": 0,
      "rule": 0,
      "limit": 0,
      "probe": "http://apitest17.boxuewenchuang.cn/test.png"
    },
    "cache": {
      "ignore": true,
      "type": 1,
      "data": [
        {
          "content": "png,jpg,gif",
          "time": 60,
          "priority": 0,
          "type": 2
        },
        {
          "content": "/",
          "time": 600,
          "priority": 0,
          "type": 3
        }
      ]
    },
    "https": {
      "cert": "",
      "jump": false
    }
  },
  "service": 0,
  "type": 0
}

成功返回示例

{    
    "code":"200",
    "message":"创建域名成功",
    "data":
    {
        "id":"82132948836417536",
        "domain":"goodman.boxuewenchuang.cn",
        "cname":"353001011a232a8c0eb51a533f9dc3fe.cdn.inspurcdn.com",
        "createTime":"2019-08-15T15:27:01Z"
    }
}

返回值

请参考通用请求返回值

错误码

以下为本接口特有的错误码。

删除加速域名

描述

  • 删除域名

URI

DELETE /cdn/domain/v1/domains/{domainId}

请求参数

参数名 位置 必选 类型 说明
domainId path string 域名id

示例

删除ID为123的加速域名

请求示例 https://cdn.cn-north-3.inspurcloudapi.com/cdn/domain/v1/domains/123

响应示例

 {
    "code": "200",
    "message": "域名删除成功!",
    "data": true
}

返回值

请参考通用请求返回值

错误码

以下为本接口特有的错误码。

查询域名全部配置

描述

  • 查询域名全部配置信息,包括基础信息、缓存配置、回源配置、https配置

URI

GET /cdn/domain/v1/domains/{domainId}`

请求参数

参数名 位置 必选 类型 说明
domainId path string 域名id

返回参数

参数名 类型 说明
code String 状态码,详见状态码文档
message String 提示信息、错误信息
result Object 返回数据
└userId String 用户名
└domain String 域名
└cname String cname
└domainStatus String 部署中:configuring,部署失败:configure_failed 审核中:checking,审核失败:check_failed,加速中:online,已停用:offline,初始中:initializing,停用中:stopping,删除中:deleting
└createdTime String 创建时间
└updatedTime String 修改时间
└serviceType int 服务类型 服务类型 0 图片小文件 1 大文件下载 2 音视频点播
└scope int 加速区域 0 中国大陆 1 港澳台及海外 2 全球
└configVersion int 配置版本
└protocol int 访问协议 0:http,1:https,2:http2
└config object 配置详情
└└origin object 源站信息
└└└protocol int 源站协议 0:遵循访问,1:http,2:https
└└└host String 回源host
└└└type int 回源类型 0 ip 1 域名
└└└range int 分片回源 0:不分片,其它:分片大小
└└└rule int 回源模式 0:普通,1:轮循,2:主备
└└└limit int 限速 0 不限速 其他 限速
└└└data Array
└└└└content String 回源内容
└└└└port int 端口
└└└└type int 回源规则 0:无,1:主,2:备
└└└└ratio int 权重
└└cache object 缓存规则
└└└type int 缓存类型 0:默认,1:自定义
└└└ignore boolean 忽略url参数 false:保留url参数,true:忽略url参数
└└└data Array 缓存配置
└└└└content String 内容
└└└└time int 缓存时间
└└└└priority int 优先级
└└└└type int 缓存类型 0:全局,1:首页,2:文件,3:文件夹,4:全路径文件
└└└└ignoreLetterCase boolean 忽略URL大小写 false:不忽略,true:忽略
└└https object https配置
└└└certName String 证书名称
└└└cert String 证书id
└└└status int https开关 0 关 1 开
└└└jump boolean 强制跳转 false:不跳转,true 跳转

示例

查询ID为104505907135643648的域名全部配置

请求示例

https://cdn.cn-north-3.inspurcloudapi.com/cdn/domain/v1/domains/104505907135643648

响应实例

{    
    "code":"200",
    "message":"查询域名配置成功"
    "data":
    {
        "userId": "63963d03-57a1-4fc4-a4fc-8a650f094528",
        "domain": "tagtest1.boxuewenchuang.cn",
        "cname": "22ad064fed806ac3cc505b1e6dc624a9.cdn.inspurcdn.com",
        "domainStatus": "offline",
        "createdTime": "2019-07-04 02:40:48",
        "updatedTime": "2019-08-20 16:38:59",
        "serviceType": 0,
        "scope": 0,
        "configVersion": 4,
        "protocol": null,
        "config": {
            "protocol": 0,
            "origin": {
                "protocol": 0,
                "host": null,
                "type": 0,
                "range": 0,
                "rule": 0,
                "limit": 0,
                "probe": null,
                "data": [
                    {
                    "content": "162.172.8.2",
                    "port": 0,
                    "type": 0,
                    "ratio": 10
                    },
                    {
                        "content": "162.172.8.3",
                        "port": 0,
                        "type": 0,
                        "ratio": 10
                    },
                    {
                    "content": "162.172.8.9",
                    "port": 0,
                    "type": 0,
                    "ratio": 10
                    }
                ]
            },
            "cache": {
                "type": 1,
                "ignore": false,
                "data": [
                    {
                        "content": "css",
                        "time": 1,
                        "priority": 3,
                        "type": 2,
                        "ignoreLetterCase": false
                    },
                    {
                        "content": "less",
                        "time": 2,
                        "priority": 2,
                        "type": 2,
                        "ignoreLetterCase": true
                    },
                    {
                        "content": "sass",
                        "time": 3,
                        "priority": 1,
                        "type": 2,
                        "ignoreLetterCase": false
                    }
                ]
            },
            "https": {
                "cert": null,
                "certName": null,
                "jump": false,
                "status": 0
            }
        }
    }
}

返回值

请参考通用请求返回值

错误码

以下为本接口特有的错误码。

修改缓存配置

描述

-修改缓存配置接口

URI

PUT /cdn/domain/v1/domains/{domainId}/cache

请求参数

参数名 位置 必选 类型 说明
domain path string 修改配置的域名
cache body int 缓存配置节点
└ignore body Boolean 不修改为null 是否忽略缓存路径参数 false 不忽略 true 忽略
└type body int 缓存基本类型 0 默认 1 自定义 必填项!!!
└data body List 缓存规则节点
└└type body int 缓存类型 0:全局(/.*) 1:首页,2:后缀/文件类型 ,3:路径/文件夹,4:正则/全路径文件
└└content body string 填写文件名后缀,“;”号分隔。如果type为首页类型,content传入"-"
└└time body int 缓存时间设置。单位:秒
└└priority body int 此条配置的权重值。取值范围:1-10, 数值越大, 优先级越高。默认值:10
└└ignoreLetterCase body Boolean 忽略URL大小写,忽略 true, 不忽略 false,默认值:true

返回参数

参数名 类型 说明
code String 状态码,详见状态码文档
message String 提示信息、错误信息
requestId String 请求Id

示例

请求示例

全量更新ID为12345678的域名的缓存配置

https://cdn.cn-north-3.inspurcloudapi.com/cdn/domain/v1/domains/12345678/cache

{
    "domain": "upsb.bboyhan.top",
    "cache": {
        "type": 1,
        "data": [
            {
                "type": "1",
                "content": "/test/",
                "time": 123,
                "priority": 1,
                ignoreLetterCase: true
            },
            {
                "type": "2",
                "content": "jpg",
                "time": 80000,
                "priority": 2,
                ignoreLetterCase: true
            },
            {
                "type": "3",
                "content": "/test/",
                "time": 123,
                "priority": 3,
                ignoreLetterCase: true
            }
        ]
    }
}

响应示例

{

    "code": "200"
    "message": "缓存配置更新成功!新配置部署中……",
    "data": true,
}

返回值

请参考通用请求返回值

错误码

以下为本接口特有的错误码。

修改回源配置

描述

  • 更新回源配置接口

URI

PUT /cdn/domain/v1/domains/{domainId}/origin`

请求参数

参数名 位置 必选 类型 说明
domainId path string 更改配置的域名Id
origin body Map 回源配置节点
└protocol body int null时不修改 源站协议 0:遵循访问,1:http,2:https
└host body string null时不修改 其他为回源Host内容
└range body string null时不修改 分片回源 0:不分片,其它:分片大小(byte)
└rule body string null时不修改 回源模式 0:普通,1:轮循,2:主备
└limit body string null时不修改 限速 0 不限速 其他 限速
└type body string 回源类型 0 ip 1 域名
└data body string 源站信息
└└type body string 回源规则 0 无 1:轮循 2 主 3 备
└└content body string 源站地址
└└port body int 默认为0 1-65535
└└ratio body int 1-10 默认10

返回参数

参数名 类型 说明
code String 状态码,详见状态码文档
message String 提示信息、错误信息
requestId String 请求Id

示例

全量更新ID为12345678的域名的回源配置

*请求示例

https://cdn.cn-north-3.inspurcloudapi.com/cdn/domain/v1/domains/12345678/origin

{
    "version":null,
    "origin": {
        "protocol": null,
        "host": "test.boxuewenchuang.cn",
        "type": 0,
        "data":[{
            "content":"10.6.6.6",
            "port":8770,
            "type":null,
            "ratio":null
        },{
            "content":"10.6.6.7",
            "port":8770,
            "type":null,
            "ratio":9
        },{
            "content":"10.6.6.8",
            "port":8770,
            "type":null,
            "ratio":8
        }],
        "range": null,
        "rule": null,
        "limit": null,
        "probe":null
  }
}

响应示例

{

    "code": "200"
    "message": "回源配置更新成功,新配置部署中!",
    "data": true,
}

返回值

请参考通用请求返回值

错误码

以下为本接口特有的错误码。

修改https配置

描述

-修改https配置

URI

PUT /cdn/domain/v1/domains/{domainId}/https`

返回参数

参数名 位置 必选 类型 说明
domainId path string 域名id
certId body string 证书id 开启HTTPS时为必填项,需通过此字段指定证书
status body int https开关 1 开 0 关
jump body Boolean 强制跳转 true 跳转 false 不跳转

返回参数

参数名 类型 说明
code String 状态码,详见状态码文档
message String 提示信息、错误信息
requestId String 请求Id

示例

全量更新ID为12345678的域名的https配置

请求示例

https://cdn.cn-north-3.inspurcloudapi.com/cdn/domain/v1/domains/12345678/https

{
    "certId":"xxxxx",
    "status":1
    "jump":false

}

响应示例

{

    "code": "200"
    "message": "修改https配置成功",
    "data": true,
}

返回值

请参考通用请求返回值

错误码

以下为本接口特有的错误码。

修改IP黑白名单

描述

-修改IP黑白名单

URI

PUT /cdn/domain/v1/domains/{domainId}/asl/ips

返回参数

参数名 位置 必选 类型 说明
domainId path string 域名id
ip body Object IP黑白名单配置项
└status body int 配置是否设置 1设置,0不设置
└type body Boolean 0: 黑名单 1:白名单
└ips body Array[String] ip或ip段信息

返回参数

参数名 类型 说明
code String 状态码,详见状态码文档
message String 提示信息、错误信息
requestId String 请求Id

示例

全量更新ID为12345678的域名的https配置

请求示例

https://cdn.cn-north-3.inspurcloudapi.com/cdn/domain/v1/domains/12345678/asl/ips

{
    "ip": {
        "ips": [
            "168.17.2.1",
            "3.3.3.3"
        ],
        "status": 1,
        "type": 0
    }
}

响应示例

{
    "code": "200",
    "message": "ALSIP配置更新成功,新配置部署中!",
    "data": true
}

返回值

请参考通用请求返回值

错误码

以下为本接口特有的错误码。