全部产品
Search
文档中心

CDN:AddCdnDomain - 添加域名

更新时间:Mar 01, 2024

调用AddCdnDomain添加加速域名。

接口说明

  • 添加域名之前,您需要先开通 CDN 服务。具体操作,请参见开通 CDN 服务
  • 加速域名必须已成功备案。
  • 每次只能添加一个加速域名,每个用户最多可以添加 50 个域名。
  • 源站内容如果不在阿里云平台上,需进行审核,审核工作会在下一个工作日前完成。
  • 单个用户的调用频率:30 次/秒。

注意事项

  • 通过接口添加了域名之后,将会有 3~5 分钟的域名生效时间,在这段时间内请不要添加任何配置,待域名状态处于 online 以后再进行下一步的配置。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。
  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:
    • 对于必选的资源类型,用背景高亮的方式表示。
    • 对于不支持资源级授权的操作,用全部资源表示。
  • 条件关键字:是指云产品自身定义的条件关键字。
  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作访问级别资源类型条件关键字关联操作
cdn:AddCdnDomainWRITE
  • Domain
    acs:cdn:*:{#accountId}:domain/{#DomainName}

请求参数

名称类型必填描述示例值
CdnTypestring

加速域名的业务类型。取值:

  • web:图片小文件。
  • download:大文件下载。
  • video:视音频点播。
web
DomainNamestring

需要接入 CDN 的加速域名。

支持泛域名,以英文句号(.)开头,例如.example.com。

.example.com
ResourceGroupIdstring

资源组 ID。

不传该参数时,系统自动补全为默认资源组 ID。

rg-acfmyuji4b6r4**
Sourcesstring

回源地址列表。

[ { "content": "192.0.2.0", "type": "ipaddr", "priority": "20", "port": 80, "weight": "15" } ]
CheckUrlstring

健康检测 URL。

www.example.com/test.html
Scopestring

加速区域。取值:

  • domestic(默认值):仅中国内地。

  • overseas:全球(不包含中国内地)。

  • global:全球。

domestic
TopLevelDomainstring

顶级接入域。

example.com
Tagobject []

标签信息列表。最大可填入 20 个标签信息。

Keystring

标签键。

env
Valuestring

标签值。

value

Sources 参数的各字段含义如下表所示。

参数类型是否必选描述
typeString源站类型。取值:
ipaddr:IP 源站。
domain:域名源站。
oss:OSS Bucket 为源站。
fc_domain:函数计算为源站。
contentString回源地址,可以是 IP 或域名。
portInteger端口。
您可以指定 443 或 80 端口,也可以自定义端口,默认值为 80 端口。443 端口支持 HTTPS 协议回源。
priorityString源站地址对应的优先级。
支持 20 和 30,默认值为 20。20 是主源,30 是备源。
weightString回源权重,取值范围为 100 以内,默认值为 10。

返回参数

名称类型描述示例值
object
RequestIdstring

请求 ID。

15C66C7B-671A-4297-9187-2C4477247A74

示例

正常返回示例

JSON格式

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

错误码

HTTP status code错误码错误信息描述
400InvalidDomainName.MalformedSpecified DomainName is malformed.域名格式错误或批量新增不支持泛域名。
400MissingParameterThe input parameter cdnType that is mandatory for processing this request is not supplied.参数cdnType为必填。
400InvalidCdnType.MalformedSpecified CdnType is malformed.参数CdnType不支持该参数值, 取值:web:图片及小文件分发;download:大文件下载加速;video:视音频点播加速;
400InvalidSources.MalformedSpecified Sources is malformed.源站地址格式错误。
400MissingParameterOrigin server information is not complete, please fill in again.-
400MissingParameterThe input parameter sourceType that is mandatory for processing this request is not supplied.参数sourceType为必填。
400InvalidSourceType.MalformedSpecified CdnType is malformed.CdnType格式错误。
400InvalidSource.Priority.MalformedThe specified Source Priority is invalid.-
400InvalidTypeAndContent.MissMatchThe specified source type does not match the specified source content.-
400InvalidScope.MalformedSpecified Scope is malformed.Scope格式错误。
400SourceIp.ExceedThe Certificate you provided is malformed证书格式不正确。
400InvalidCertificateThe Certificate you provided is malformed证书格式不正确。
400InvalidCertificate.TooLongThe Certificate you provided is over the max length证书和私钥长度超出限制。
400InnerAddDomainDeniedYour account has not bind aoneId, can not add domain.您的帐户没有绑定aoneId,不能添加域名。
400CheckSourceHealthFailedsources ip or source domain check health failed,please input right source.源IP或源域检查错误, 请输入正确的源。
400ExtensiveAndAllBothExistExtensive domain and the domain begins with all. can not exist at the same time.泛域名与all.开头域名不能同时存在。
400CdnTypeNotSupportExtensiveDomainExtensive domain not supported for this cdn type.泛域名不支持该业务类型,目前泛域名只支持图片小文件加速,大文件下载加速,视频点播加速,请知悉。
400ExtensiveAndSpecificDomainConflictThe number of wildcard domain names exceeds the limit.-
400InvalidResourceGroupId.MalformedSpecified ResourceGroupId is malformed.参数ResourceGroupId格式错误。
400DomainReservedThe root domain of your domain is reserved by another account. Submit a ticket to contact customer support.-
400InvalidDomainNameLevelDomain name suffixed with alicdn.com only support third level.alicdn.com(针对泛域名)最多支持三级域名。
400InvalidTopLevelDomain.MalformedSpecified TopLevelDomain is malformed.参数TopLevelDomain错误。
400TopLevelDomain.NotFoundTopLevelDomain is not exist.TopLevelDomain不存在。
400EntityNotExists.ResourceGroupThe resource group does not exist.资源组不存在。
400EntityNotExist.ResourceGroupThe resource group does not exist.该资源组不存在。
400InvalidStatus.ResourceGroupIt is not allowed to do this operation because of the current status of resource-group.资源组当前状态不允许进行此操作。
400NotInternationRealIdentityYou need to do real name authentication when you use Chinese mainland resources.根据中华人民共和国法律规定,在中国境内购买使用信息服务的用户需要进行实名登记。
400Abs.CheckUrl.MalformedThe CheckUrl you provided is malformed.-
400RecordCheckNotAvailableThe ICP filing interface is unavailable. Please try again later.-
400IcpBlackThe domain is on the ICP blacklist.-
400IspBlackThe domain is on the ISP blacklist.-
400DomainOwnerVerifyFailOwner verification of the root domain failed.当您首次将新域名添加至阿里云CDN时,需按要求做域名归属权验证,当您按要求配置DNS解析或文件验证后,才能正常成功添加域名。 
400TopLevelDomain.MismatchThe specified TopLevelDomain does not match webSiteType.顶级接入域和域名类型不匹配。
400DomainInBlacklistThe domain is in the blacklist.该域名在黑名单中。
400InvalidTagKeyThe specified TagKey is invalid.-
400InvalidTagValueThe specified TagValue is invalid.-
400InvalidTagKey.RepeatedThe specified TagKey is duplicated.-
400InvalidTagThe specified Tag is Invalid.-
400InvalidTagKey.OverLimitThe number of Tag can not over limit 20.-
400SourceInBlacklistSource is in the blacklist.源站在黑名单中。
400InvalidTagKeyThe key should not be null, start with "acs:" or "aliyun", contain "http://" or "https://" or have special symbols:.!@#$%?/^&*)(+={}[]",'<>~·`?;.-
400InvalidTagValueThe tag value cannot contain these special symbols:http://, https://-
400ReservedTagKeyThe tag key is used internally as a reserved field and is not allowed to be used.-
400DomainOverLimitThe maximum number of domains is exceeded.域名数量超过上限
403AccountExceptionAccount exception. Please open ticket to make an appeal.-

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
2023-12-12OpenAPI 错误码发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    错误码 400 变更
    删除错误码:403
2023-08-08OpenAPI 错误码发生变更、OpenAPI 入参发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    删除错误码:400
    删除错误码:403
入参OpenAPI 入参发生变更
    删除入参:GlobalResourcePlan
2023-06-27OpenAPI 错误码发生变更、OpenAPI 入参发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    删除错误码:400
    删除错误码:403
入参OpenAPI 入参发生变更
    新增入参:GlobalResourcePlan