You can call this operation to create an accelerated domain.

When you call this operation, follow these rules:
  • You can create only one accelerated domain for each call. Each account supports creating up to 20 accelerated domains.
  • Before you create an accelerated domain, you must activate Alibaba Cloud CDN. For more information, see Activate the Alibaba Cloud CDN service.
  • Make sure that you have obtained an Internet content provider (ICP) filling for the accelerated domain.
  • If the origin content is not saved on the Alibaba Cloud platform, the content must be reviewed. The review will be completed by the end of the next working day after you submit the application.

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 AddCdnDomain

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

CdnType String Yes web

The business type of the accelerated domain. Valid values:

  • web: the acceleration of image and small file distribution.
  • download: the acceleration of large file downloads.
  • video: the acceleration of on-demand video and audio streaming.
DomainName String Yes .yourdomain.com

The name of the accelerated domain to be created. Wildcard domain names are supported. Wildcard domain names must start with a period (.).

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

The URL that is used to test the accessibility of the origin.

ResourceGroupId String No your resourceGroupId

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

Scope String No domestic

The region where your CDN service is deployed. Valid values:

  • domestic (default): mainland China.
  • overseas: outside mainland China.
  • global: all countries in the world.
Sources String No [{"content":"1.1.1.1","type":"ipaddr","priority":"20","port":80,"weight":"15"}]

The origin information.

TopLevelDomain String No www.yourTopLevelDomain

The primary domain name.

Parameters in Sources

Parameter

Type

Required

Description

type

String

Yes

The type of the origin. Valid values:

ipaddr: IP address

domain: domain name

oss: Internet domain name of an Alibaba Cloud Object Storage Service (OSS) bucket

fc_domain: Function Compute domain name

content

String

Yes

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

port

Integer

No

The port number. You can specify port 443 or 80. You can also customize the port number. Default value: 80. If you specify port 443, Alibaba Cloud CDN will communicate with the origin over HTTPS.

priority

String

No

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

weight

String

No

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

Response parameters

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

The ID of the request.

Samples

Sample requests

http://cdn.aliyuncs.com?Action=AddCdnDomain
&CdnType=web
&SourceType=domain
&DomainName=test.com
&Sources=[{"content":"1.1.1.1","type":"ipaddr","priority":"20","port":80,"weight":"15"}]
&<Common request parameters>

Sample success responses

XML format

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

JSON format

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

Error codes

HTTP status code Error code Error message Description
400 InvalidDomainName.Malformed Specified DomainName is malformed. The error message returned because the specified 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 specified.
400 InvalidCdnType.Malformed Specified CdnType is malformed. The error message returned because the specified CdnType parameter is invalid. Valid values: web, download, video, and liveStream.
400 InvalidSources.Malformed Specified Sources is malformed. The error message returned because the specified Sources parameter is invalid. You can specify up to 20 IP addresses that are separated with commas (,) or one domain name. You cannot specify a combination of an IP address and a domain name.
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 specified.
400 InvalidSourceType.Malformed Specified CdnType is malformed. The error message returned because the specified CdnType parameter is invalid.
400 InvalidScope.Malformed Specified Scope is malformed. The error message returned because the specified Scope parameter is invalid.
400 SourceIp.Exceed The Certificate you provided is malformed! The error message returned because the specified certificate is invalid.
400 InvalidCertificate The Certificate you provided is malformed! The error message returned because the specified 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 create an accelerated domain by using an account that has not been bound to an Aone ID.
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 character string "all." cannot exist at the same time.
400 CdnTypeNotSupportExtensiveDomain Extensive domain not supported for this cdn type. The error message returned because wildcard domains do not support the specified business type. Wildcard domains only support the following business types: web, download, and video.
400 ExtensiveAndSpecificDomainConflict Extensive domain and corresponding specific domain are mutually exclusive. The error message returned because the wildcard domain name matches an existing exact domain name at the corresponding level. Wildcard domain names are mutually exclusive with the matching exact domain names.
400 InvalidResourceGroupId.Malformed Specified ResourceGroupId is malformed. The error message returned because the specified ResourceGroupId parameter is invalid.
400 InvalidDomainNameLevel Domain name suffixed with alicdn.com only support third level. The error message returned because the specified accelerated domain is not supported. Alibaba Cloud CDN supports up to four levels in an accelerated domain name.
400 InvalidTopLevelDomain.Malformed Specified TopLevelDomain is malformed. The error message returned because the specified TopLevelDomain parameter is invalid.
400 TopLevelDomain.NotFound TopLevelDomain is not exist. The error message returned because the specified TopLevelDomain parameter 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 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 authentication that is required to use resources in mainland China.

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