Adds a domain name to Alibaba Cloud CDN.

Before you call this operation, take note of the following rules:
  • You can specify only one domain name in each request. You can add a maximum of 20 domain names.
  • Make sure that Alibaba Cloud CDN is activated.
  • Make sure that the Internet Content Provider (ICP) number for the domain name is obtained.
  • If the origin content is not saved on Alibaba Cloud, the content must be reviewed. The review is finished by the end of the next business day after you submit the request.

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 software development kits (SDKs).

Request parameters

Parameter Type Required Example Description
Action String Yes AddCdnDomain

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

CdnType String Yes web

The workload type of the domain name. Valid values:

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

The domain name to be added to Alibaba Cloud CDN. Wildcard domain names are supported.Wildcard domain names must start with periods (.).

CheckUrl String No www.yourdomain.com/test.html

The health check on the origin server.

Priorities String No 20

The priority of the origin server. Separate multiple priorities with commas (,). Make sure that the number of priorities is the same as the number of origin servers.

Region String No cn-shanghai

The region ID of the live domain. Valid values: cn-beijing, cn-shanghai, cn-shenzhen, and ap-southeast-1.

ResourceGroupId String No your resourceGroupId

The ID of the resource group.

Scope String No domestic

The acceleration region. Valid values:

  • domestic: mainland China only.
  • overseas: global (excluding mainland China).
  • global (default): all countries in the world.
SourcePort Integer No 80

The port number. Valid values: 443 and 80. Default value: 80.

If you specify port 443, Alibaba Cloud CDN communicates with the origin server over HTTPS. Object Storage Service (OSS) buckets do not support port 443.

SourceType String No domain

The type of the origin server. Valid values:

  • ipaddr: the IP address of the origin server.
  • domain: the domain name of the origin server.
  • oss: an OSS bucket.
Note If you set the CdnType parameter to liveStream, you do not need to specify the origin type or origin information.
Sources String No www.yourdomain.com

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

  • You can specify up to 20 IP addresses and separate them with commas (,).
  • You can specify only one domain name. You cannot specify the IP address and domain name at the same time.
  • This parameter is not required if you set the CdnType parameter to liveStream.
TopLevelDomain String No www.yourTopLevelDomain

The top-level domain.

Response parameters

Parameter Type Example Description
RequestId String 16A96B9A-F203-4EC5-8E43-CB92E68F4CD8

The ID of the request.

Examples

Sample requests

http(s)://cdn.aliyuncs.com/?Action=AddCdnDomain
&CdnType=web
&SourceType=domain
&DomainName=example.com
&Sources=example.com
&<Common request parameters>

Sample success responses

XML format

<AddCdnDomainResponse>
    <RequestId>A22F5DDD-E6B8-4DB4-A210-FF3CA5A82644</RequestId>
</AddCdnDomainResponse>

JSON format

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

Error codes

HttpCode Error code Error message Description
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 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 MissingParameter The input parameter region that is mandatory for processing this request is not supplied. The error message returned because the Region parameter must be specified.
400 Region.NotExist The input parameter region is not exist. The error message returned because the specified region does not exist.
400 InvalidDomainName.Malformed Specified DomainName is malformed. The error message returned because the value of the DomainName parameter is invalid.
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 InvalidSourceType.Malformed Specified CdnType is malformed. The error message returned because the format of the CdnType parameter is invalid.
400 InvalidSources.Malformed Specified Sources is malformed. The error message returned because the format of the specified Sources parameter is invalid. You can set Sources to an IP address or a domain name. You can specify up to 20 IP addresses or one domain name. Separate IP addresses with commas (,). You cannot specify both IP addresses and domain names in the same call.
400 InvalidSourcePort.Malformed Specified port is not supported. The error message returned because the specified SourcePort parameter is not supported.
400 InvalidScope.Malformed Specified Scope is malformed. The error message returned because the format of the Scope parameter is invalid.
400 InvalidTopLevelDomain.Malformed Specified TopLevelDomain is malformed. The error message returned because the value of the TopLevelDomain parameter is invalid.
400 SourceIp.Exceed The Certificate you provided is malformed! The error message returned because the format of the SSL certificate is invalid.
400 InvalidCertificate The Certificate you provided is malformed! The error message returned because the format of the SSL certificate is invalid.
400 InvalidCertificate.TooLong The Certificate you provided is over the max length! The error message returned because the length of the specified certificate and private key exceeds the upper limit.
400 InnerAddDomainDenied Your account haven't bind aoneId, can not add domain. The error message returned because you cannot add a domain name by using an Alibaba Cloud account that is not associated with an Aone ID (aoneId).
400 ExtensiveAndAllBothExist Extensive domain and the domain begins with 'all.' can not exist at the same time. The error message returned because wildcard domain names and domain names that start with the string "all."cannot exist simultaneously.
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 domains support only the following workload types: web, download, and video.
400 ExtensiveAndSpecificDomainConflict Extensive domain and corresponding specific domain are mutually exclusive. The error message returned because the specified wildcard domain name overlaps an exact match domain name at the same level. Specify another domain name.
400 InvalidParameter Add live region parameters have error. The error message returned because the specified Region parameter is invalid.
400 InvalidRegion.Malformed Specified Region is malformed. The error message returned because the specified Region parameter is invalid.
400 InvalidParameter There is unsupported parameter. The error message returned because the specified parameter is not supported.
400 InvalidResourceGroupId.Malformed Specified ResourceGroupId is malformed. The error message returned because the format of the ResourceGroupId parameter is invalid.
400 InvalidDomainNameLevel Domain name suffixed with alicdn.com only support third level. The error message returned because the specified domain is not supported. Alibaba Cloud CDN supports only top-level, second-level, and third-level domain names that are suffixed with alicdn.com.
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 InvalidStatus.ResourceGroup It's now allowed to do this operation because of the current status of resource-group. The error message returned because the operation is not allowed when the resource group is in the current state.
400 InvalidPriorities.Malformed The length of priorities is not the same with source. The error message returned because the number of priority values does not match the number of origin servers.
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.