Development Document

Domain Creation Download PDF Document

Endpoint

Request URL: domain (POST)

Endpoint Domain Name: cdn.api.baishan.com
Endpoint Version: v2

Endpoint Description

Create a domain name.

Notice: Creating a domain name currently only supports origin and origin host configurations.

API Parameters

Notice: Please request the API token from your account team.

Request Parameters (POST)

Supported request data formats: form-data, x-www-form-urlencoded, and json.

ParameterData TypeRequirementDescription
domainstringRequiredThe domain name that needs to be created, such as www.abc.com.
typestringRequiredDomain name type, optional values arepage, download, video_demand, dynamic.
configarrayRequiredSpecify theparameter &change. Creating domain name only supports origin and origin_host configuration. See Modify Configuration.

Origin Settings

Supported request data formats: form-data, x-www-form-urlencoded, and json.

ParameterData TypeRequirementDescription
default_masterstringRequiredDefault origin. Can provide up to 6 IPs or domain names, separated by a comma (,). For example, "133.233.133.33,133.233.22.33".
default_slavestringOptionalBackup origin. Can provide up to 6 IPs or domain names, separated by a comma (,). For example, "133.233.133.33,133.233.22.33". Backup origins MUST be different from the default origins.
origin_modestringOptionalSelect the protocol Baishan servers should use to contact the origin with. The values can be:http,https,default,custom
origin_mode=http: forward requests to the origins via HTTP and port 80.
origin_mode=https:foward requests to the origins via HTTPS and port 443.
origin_mode=default:forward requests to the origins via the same protocol as the end user's request.
origin_mode=custom:Customize ori_https and port number.
ori_httpsstringOptionalSpecify whether HTTPS should be used when contacting the origin. The options are yes,no.Can only be used when origin_mode=custom. .
portIntoptionalSpecify the port number to use when contacting the origin. Default is port 80. Can only be used when origin_mode=custom. . (0- 65535)

Origin_host

Supported request data formats: form-data, x-www-form-urlencoded, and json.

ParameterData TypeRequirementDescription
hoststringRequiredSpecify what the host header should be when contacting the origin, for example, "test.qingcdn.com"

Sample Request:

curl -X POST "https://cdn.api.baishan.com/v2/domain?token=xxx"\
    -H "Content-Type: application/json"\
    -d '{
    "domain":"www.aa.com",
    "type":"page",
    "config":{
        "origin":{
            "default_master":"1.1.1.1"
        }
    }
}'

Sample Response

Json format.

{
    "code": 0, //0 = Success. Other code is displayed if the request failed.
    "data": {
        "id": "2729151231",
        "domain": "www.aa.com",
        "type": "page",
        "status": "deploying",
        "cname": "aa.com.qingcdn.com.",
        "config": {
            "origin": {
                "default_master": "1.1.1.1."
            }
        }
    }
}

Response Header

HTTP/1.0 200 OK
Api-Id:                100438085
Content-Type:          application/json; charset=utf-8
X-Ratelimit-Grad:      minute
X-Ratelimit-Limit:     100
X-Ratelimit-Remaining: 100
X-Retry-After:         1

HTTP Status Codes

Error CodeDescription
404Bad request URLs.
401Authorization Error: Invalid token or lack of access.
400Bad request parameters.
200Success.
5xxPlease contact your account team.
CopyRight © 2015-2022 BaishanCloud . All Rights Reserved.