2.1 频道开通

2.1.1 描述

通过调用该接口为指定的域名开通加速服务。

2.1.2 请求地址

地址:https://api.bokecs.com/channel/open

2.1.3 请求方式

POST

2.1.4 请求参数

1) 请求入参
{
    "domain": {
    "name": "",
    "type": "",
    "origin_type": "",
    "origin_ips": [
      {
        "address": ""
      },
       ……
     ],
    "origin_domain": "",
    "cache_policies": [
      {
        "path_pattern": "",
        "cache_ttl": ,
        "ignore_cache_control": "",
        "is_cached":
       },
       ……
     ],
    "access_policies": [
      {
        "forbidden_referers": "",
        "allow_referers": "",
        "forbidden_ips": ""
       },
       ……
       ]
  }
}

当origin_type类型为ip时,origin_ips必须存在,origin_type类型为domain时,origin_domain必须存在。

元素名称

是否必须

元素描述

name

频道名称

type

产品类型。目前支持以下几种:WEB(网页加速)、 DOWNLOAD(下载)、 VODSTREAM(流媒体)

origin_type

回源类型。ip、domain

origin_ips

回源ip。当回源类型为ip,必须存在该元素

address

回源ip地址。origin_ips元素存在时,必须存在该元素

origin_domain

回源域名。当回源类型为domain,必须存在该元素

cache_policies

缓存策略配置

path_pattern

缓存路径匹配规则。比如:/*.css。cache_policies存在时,必须存在该元素

is_cached

是否缓存,true(缓存)、false(不缓存)。默认true。cache_policies存在时,必须存在该元素

cache_ttl

缓存时间,单位:秒。is_cached为true时,必须存在该元素

ignore_cache_control

是否忽略请求头中的cache control配置。true(忽略)、false(不忽略)。is_cached为true时,必须存在该元素

access_policies

访问控制配置

forbidden_ips

ip黑名单。多个用,隔开

forbidden_referers

域名黑名单。多个用,隔开

allow_referers

域名白名单。多个用,隔开

2) 请求出参
{
"code": "",
"message": "",
"channel_id": ""
}

code:接口响应代码。200表示成功。
message: 接口响应信息。
channel_id: 频道唯一标识。

2.1.5 举例说明

1)加速普通域名
{
    "domain": {
    "name": "www.test.com",
    "type": "WEB",
    "origin_type": "ip",
    "origin_ips": [{
        "address": "1.1.1.1"
    }],
    "cache_policies": [{
        "path_pattern": "/*.jpg",
        "cache_ttl": 1200,
        "ignore_cache_control": "true",
        "is_cached":true
     }],
    "access_policies": [{
        "forbidden_ips": "1.1.1.1,1.1.1.2,1.1.1.3"
     }]
  }
}

results matching ""

    No results matching ""