Baidu AI Cloud
中国站

百度智能云

CDN

Single Domain Name Copy Interface

Get the Configuration Item Interface

The interface is used for getting certain configuration item interface with replicable domain name.

method path Description
GET /v2/config_copy/list Access the configuration items of domain that can be copied

Request parameter

Parameter Optional Type Description
domain Required string Need to get the domain name of copying the configuration item

Response parameter

Parameter Optional Type Description
configs Required map<key:CONFIG> For the list of configuration items that can be copied, the key is the mapping value of each configuration item agreed with the frontend.

CONFIG type description:

Parameter Optional Type Description
type Required string The value is switch || json || rule
value Required int|bool Values corresponding to switch and json is in bool type, respectively indicating the ON and OFF of the switch and whether it has been set. The value of rule is int, indicating the number of rules.

Request example

GET /v2/config_copy/list?domain=test16.baidu.com HTTP/1.1 
Host: cdn.baidubce.com 
Accept: */* 
Authorization: bce-auth-v1/de8b14eb27d74332bbd8266d474c8aec/2020-01-10T03:47:40Z/18000/host/56d4e5a68fb636e17333921d931d775beb4cb5f2e72e272f458821949d9af9d1 
Content-Length: 168
Content-Type: application/x-www-form-urlencoded

Response example

HTTP/1.1 200 OK 
 
Server: nginx 
Date: Fri, 10 Jan 2020 03:47:42 GMT 
Content-Type: application/json; charset=utf-8 
Transfer-Encoding: chunked 
Connection: keep-alive 
X-Powered-By: PHP/7.2.0 
x-bce-request-id: f41fcede-2f1b-6ea9-b9a8-9c90a0631738
 
{ 
    "configs": { 
        "follow301and302": { 
            "type": "switch", 
            "value": true 
        }, 
        "compress": { 
            "type": "json", 
            "value": true 
        }, 
        "emptyRefererEnabled": { 
            "type": "switch", 
            "value": false 
        }, 
        "limitBandwidth": { 
            "type": "json", 
            "value": true 
        }, 
        "mobileAccess": { 
            "type": "json", 
            "value": true 
        }, 
        "originConfig": { 
            "type": "json", 
            "value": true 
        }, 
        "setHttpHeader": { 
            "type": "rule", 
            "value": 3 
        }, 
        "uaACL": { 
            "type": "rule", 
            "value": 1 
        } 
    } 
} 

Submit the Task Copy Interface

method path Description
POST /v2/config_copy/submit Submit configuration copy tasks

Request parameter

Parameter Optional Type Description
originDomain Required originDomain Provide the domain name for copying configurations
domains Required list<domain> Domain name list to be copied
configs Required list<config> Configuration list to be copied, config is the key corresponding to the domain name configuration item.

Response parameter

Parameter Optional Type Description
taskId Required string The unique id marking the task

Request example

POST /v2/config_copy/submit HTTP/1.1 
Host: cdn.baidubce.com 
Accept: */* 
Authorization: bce-auth-v1/de8b14eb27d74332bbd8266d474c8aec/2020-01-10T03:54:34Z/18000/host/f8ad347b8406b670b1bcb226d3b2912ee10a86b66c9801befa058f205f6f2800 
Content-Length: 130
Content-Type: application/x-www-form-urlencoded
 
{ 
    "originDomain": "test16.baidu.com", 
    "domains": [ 
        "ceshieip.baidu.com"
    ], 
    "configs": [ 
        "originConfig", 
        "compress", 
        "setHttpHeader", 
        "uaACL" 
    ] 
} 

Response example

HTTP/1.1 200 OK 
Server: nginx 
Date: Fri, 10 Jan 2020 03:54:34 GMT 
Content-Type: application/json; charset=utf-8 
Transfer-Encoding: chunked 
Connection: keep-alive 
X-Powered-By: PHP/7.2.0 
x-bce-request-id: c25b6c9e-195f-cce9-60d9-f4369627b3de
 
{"taskId":"0e5461ac524658668503cfc32230fed9"} 

Query Task Status Interface

method path Description
GET /v2/config_copy/status Query the current task status of the user

Request parameter

Parameter Optional Type Description
taskId Required string The task id to query

Response parameter

Parameter Optional Type Description
messages Required list<domain> Domain name with failed operation
status Required string running, failed and success respectively indicate that the task corresponding to taskId is still running, failed to execute all domain names and executed domain names successfully or some were successful

MESSAGE type description:

Parameter Optional Type Description
domain Required string Domain name with failed execution

Request example

GET /v2/config_copy/status?taskId=0e5461ac524658668503cfc32230fed9 HTTP/1.1 
Host: cdn.baidubce.com 
Accept: */* 
Authorization: bce-auth-v1/de8b14eb27d74332bbd8266d474c8aec/2020-01-10T03:59:49Z/18000/host/767024e48bef3dfb016d0bce60093b6c1a4ff185452195d814fb83e672a89240 

Response example

HTTP/1.1 200 OK 
 
Server: nginx 
Date: Fri, 10 Jan 2020 03:59:49 GMT 
Content-Type: application/json; charset=utf-8 
Transfer-Encoding: chunked 
Connection: keep-alive 
X-Powered-By: PHP/7.2.0 
x-bce-request-id: c67adcf6-1d7e-7c81-45d6-ccbe92060079
 
{"status":"success","messages":[]} 
Previous
Query Whether the Domain Name can be Filed
Next
Domain Name Configuration Interface