Adds multiple domain names to Alibaba Cloud CDN at a time. You can add a maximum of 20 domain names to Alibaba Cloud CDN with each Alibaba Cloud account.

Note
  • You must activate Alibaba Cloud CDN before you can add a domain name to it. For more information, see Activate Alibaba Cloud CDN.
  • The domain name that you want to add has a valid Internet Content Provider (ICP) number.
  • If the content from the origin server is not stored on Alibaba Cloud, the content must be reviewed by Alibaba Cloud. The review will be completed by the end of the next business day after you submit the application.
  • You can specify multiple domain names (no more than 50) and separate them with commas (,).
  • The maximum number of times that each user can call this operation per second is 30.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes BatchAddCdnDomain

The operation that you want to perform. Set the value to BatchAddCdnDomain.

CdnType String Yes web

The workload type of the domain name to be accelerated. Valid values:

  • web: images and small files.
  • download: large files.
  • video: on-demand video and audio streaming.
DomainName String Yes example.com,example.org

The domain names that you want to add to Alibaba Cloud CDN. Separate domain names with commas (,).

Sources String Yes [{"content":"1.1.1.1","type":"ipaddr","priority":"20","port":80,"weight":"15"}]

The information about the addresses of the origin servers.

ResourceGroupId String No rg-acfmyuji4b6r4**

The ID of the resource group. If you do not set this parameter, the system uses the ID of the default resource group.

CheckUrl String No url

The URL that is used for health checks.

Scope String No domestic

The accelerated region. Valid values:

  • domestic: mainland China only
  • overseas: global (excluding mainland China)
  • global: global
TopLevelDomain String No example.com

The top-level domain name.

The following table describes the fields in the Sources parameter.

Field

Type

Required

Description

type

String

Yes

The type of the origin server. Valid values:

ipaddr: The origin server uses an IP address.

domain: The origin server uses a domain name.

oss: The origin server uses an Object Storage Service (OSS) bucket.

fc_domain: The origin server uses a Function Compute domain name.

content

String

Yes

The address of the origin server. You can specify an IP address or a domain name.

port

Integer

No

You can specify port 443, port 80, or a custom port. Default value: 80. If you specify port 443, Alibaba Cloud CDN communicates with the origin server over HTTPS.

priority

String

No

The priority of the origin server if multiple origin servers are specified. Valid values: 20 and 30. Default value: 20. A value of 20 specifies that the origin server is the primary origin server. A value of 30 specifies that the origin server is a secondary origin server.

weight

String

No

The weight of the origin server if multiple origin servers are specified. You must specify a value smaller than 100. Default value: 10.

Response parameters

Parameter Type Example Description
RequestId String 15C66C7B-671A-4297-9187-2C4477247A74

The ID of the request.

Examples

Sample requests

http(s)://cdn.aliyuncs.com/?Action=BatchAddCdnDomain
&CdnType=web
&DomainName=example.com,example.org
&Sources=[{"content":"1.1.1.1","type":"ipaddr","priority":"20","port":80,"weight":"15"}]
&<Common request parameters>

Sample success responses

XML format

<BatchAddCdnDomainResponse>
      <RequestId>15C66C7B-671A-4297-9187-2C4477247A74</RequestId>
</BatchAddCdnDomainResponse>

JSON format

{
  "RequestId": "15C66C7B-671A-4297-9187-2C4477247A74"
}

Error codes

HttpCode Error code Error message Description
400 InvalidDomainName.Malformed Specified DomainName is malformed. The error message returned because the value of the DomainName parameter is invalid.
400 MissingParameter The input parameter cdnType that is mandatory for processing this request is not supplied. The error message returned because the CdnType parameter must be set.
400 InvalidCdnType.Malformed Specified CdnType is malformed. The error message returned because the value of the CdnType parameter is invalid. Valid values: web (delivery of image and small files), download (delivery of large files), video (on-demand audio and video streaming), and liveStream (live streaming).
400 InvalidSources.Malformed Specified Sources is malformed. The error message returned because the origin server address is specified in an invalid format.
400 MissingParameter The input parameter sourceType that is mandatory for processing this request is not supplied. The error message returned because the SourceType parameter must be set.
400 InvalidSourceType.Malformed Specified CdnType is malformed. The error message returned because the format of the CdnType parameter is invalid.
400 InvalidScope.Malformed Specified Scope is malformed. The error message returned because the format of the Scope parameter is invalid.
400 CdnTypeNotSupportExtensiveDomain Extensive domain not supported for this cdn type. The error message returned because wildcard domains do not support the specified workload type. Wildcard domain names support only the following workload types: web, download, and video.
400 InvalidResourceGroupId.Malformed Specified ResourceGroupId is malformed. The error message returned because the format of the ResourceGroupId parameter is invalid.
400 DomainReserved The root domain of your domain is reserved by another account. Submit a ticket to contact customer support. The error message returned because the root domain of the specified domain name is used by another Alibaba Cloud account. If you want to add the domain name, submit a ticket.
400 InvalidDomainNameLevel Domain name suffixed with alicdn.com only support third level. The error message returned because the specified domain name is not supported. Alibaba Cloud CDN supports only top-level, second-level, and third-level domain names that are suffixed with alicdn.com.
400 InvalidTopLevelDomain.Malformed Specified TopLevelDomain is malformed. The error message returned because the value of the TopLevelDomain parameter is invalid.
400 TopLevelDomain.NotFound TopLevelDomain is not exist. The error message returned because the specified top-level domain name (TopLevelDomain) does not exist.
400 EntityNotExists.ResourceGroup The resource group does not exist. The error message returned because the specified resource group does not exist.
400 NotInternationRealIdentity You need to do real name authentication when you use Chinese mainland resources. The error message returned because you have not completed the real-name verification that is required for purchasing or using information Internet content services in mainland China.
400 DomainOwnerVerifyFail Owner verification of the root domain failed. The error message returned because you must prove the ownership of the domain name before you can add it to Alibaba Cloud CDN. The first time a domain name is added to Alibaba Cloud CDN, you must prove the ownership of the domain name. You can prove the ownership by adding a DNS record or upload a verification file.

For a list of error codes, visit the API Error Center.