调用BatchSetCdnDomainConfig进行域名批量配置。
接口说明
单用户调用频率:3 次/秒。
支持批量配置域名,多个域名用半角逗号(,)分隔,一次最多支持配置 50 个域名。
调用 BatchSetCdnDomainConfig 给域名配置某些功能后,将会生成唯一的 ConfigId,通过 ConfigId 可以完成更新和删除配置操作。具体使用方法,请参见 ConfigId 使用与查询。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
cdn:BatchSetCdnDomainConfig |
update |
*Domain
|
无 |
|
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| DomainNames |
string |
是 |
加速域名,多个域名用半角逗号(,)分隔,注意以下配置限制:
|
www.example.com |
| Functions |
string |
是 |
功能列表,一次传入最多 50 条,格式如下:
parentId 为 -1:表示删除该配置里面已有的规则条件。
不使用 parentId 的情况下,配置示例如下: 使用函数origin_request_header添加回源 HTTP 请求头的时候引用了configid=222728944812032的规则条件,请求参数如下:
使用 parentId 的情况下,配置示例如下: 使用函数origin_request_header添加回源 HTTP 请求头的时候引用了configid=222728944812032的规则条件,请求参数如下:
对一个已经使用了 parentId 的功能配置删除对 parentId 的引用,配置示例如下: 函数origin_request_header添加回源 HTTP 请求头的时候已经引用了configid=222728944812032的规则条件,现在要删掉对规则条件的引用,请求参数如下: |
[{"functionArgs": [{"argName": "key","argValue": "Content-Encoding"},{"argName": "value","argValue": "gzip"}],"functionName": "set_resp_header"} ] |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
请求 ID。 |
04F0F334-1335-436C-A1D7-6C044FE73368 |
| DomainConfigList |
object |
||
| DomainConfigModel |
array<object> |
域名配置清单。 |
|
|
object |
|||
| ConfigId |
integer |
配置 ID,如果返回为 0,则表示该条配置未配置成功,需要重新配置。 |
1234567 |
| DomainName |
string |
域名。 |
www.example.com |
| FunctionName |
string |
功能名称。 |
set_resp_header |
示例
正常返回示例
JSON格式
{
"RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368",
"DomainConfigList": {
"DomainConfigModel": [
{
"ConfigId": 1234567,
"DomainName": "www.example.com",
"FunctionName": "set_resp_header"
}
]
}
}
异常返回示例
JSON格式
[{"functionArgs":[{"argName":"file_type","argValue":"jpg"},{"argName":"ttl","argValue":"18"},{"argName":"weight","argValue":"30"}],"functionName":"filetype_based_ttl_set","configId":5068995}]
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidFunctions.Malformed | The specified Functions is incorrectly formatted. | 配置格式错误。 |
| 400 | InvalidArgValue.Malformed | The specified ArgValue is invalid. | 参数格式错误,请检查更新后重试。 |
| 400 | Invalid%s.ValueNotSupported | [%s] is not supported. | |
| 400 | Invalid%s.Malformed | The specified ArgValue [%s] is invalid. | |
| 400 | MissingParameter%s | The specified value of ArgName[%s] is missing. | 参数不能为空。 |
| 400 | InvalidFunctionArgs.Malformed | The specified FunctionArgs is invalid. | 指定的功能参数是错误的。 |
| 400 | MissingParameter | The specified ArgValue is missing. | |
| 400 | InvalidHeaderKey.ValueNotSupported | The specified value of parameter HeaderKey is not supported. | 指定的HTTP头参数不合法,超出可选范围。取值:Content-Type,Cache-Control,Content-Disposition,Content-Language,Expires,Access-Control-Allow-Origin,Access-Control-Allow-Methods,Access-Control-Allow-Headers,Access-Control-Max-Age,Access-Control-Expose-Headers,Access-Control-Allow-Credentials。 |
| 400 | TooManyDomains | The count of domain is over 50. | |
| 400 | InvalidRule.Malformed | %s | |
| 400 | ConfigurationConflicts | The staging environment has a configuration in effect and cannot modify the production environment configuration. | 现在模拟环境的配置和生产环境配置不一致,无法直接修改生产环境配置。请您前往模拟环境完成您所需的配置,然后发布到生产环境进行覆盖。 |
| 400 | InvalidFunction.NotSupported | The domain is not supported to set the function. | 域名不支持设置该功能。 |
| 400 | InvalidDomain.BelongToConfigGroup | This Domain activated in configuration group and should modify by config group. | |
| 400 | EntityNotExist.Role | EntityNotExist.Role | |
| 400 | MissingParameterFunctions | The specified value of Functions is missing. | |
| 400 | NoPermission.SLR | The current user does not have permission to create servicelinkedrole. Please contact the Alibaba Cloud account or administrator to authorize AliyunCDNFullAccess or custom policy:Service Name:cdn-ddos.cdn.aliyuncs.com,Role: AliyunServiceRoleForCDNAccessingDDoS,Permission: ram: CreateServiceLinkedRole | 当前用户没有创建服务关联角色的权限,请联系主账号或权限管理员授权AliyunCDNFullAccess或授权创建服务关联角色的自定义权限策略。自定义权限策略的相关信息如下: Service Name:cdn-ddos.cdn.aliyuncs.com 服务关联角色名称:AliyunServiceRoleForCDNAccessingDDoS 执行该操作所需的用户权限:ram:CreateServiceLinkedRole |
| 400 | ConfigExceedLimit | Count of config entries exceeds the limit. | 配置条数超过限制。 |
| 400 | EdgeScriptCountExceedLimit | The number of rules exceeds the default limit. | 超过默认规则数量限制,如需提升数量,请提交工单咨询。 |
| 400 | EdgeScripOptionsHasInnerConfig | The extension has a background configuration or a parameter of this configuration is invalid. For more information, submit a ticket. | 扩展项存在后台配置或该配置的参数不合法,如有疑问,请提交工单咨询 |
| 400 | EdgeScriptGrammarNotSupport | A background customization rule exists or a parameter of this configuration is invalid. For more information, submit a ticket. | 存在后台定制规则或该配置的参数不合法,如有疑问,请提交工单咨询 |
| 400 | EdgeScriptNotSupportJs | JavaScript rules are not supported. For more information, submit a ticket. | 未开放JS规则,如有疑问,请提交工单咨询 |
| 400 | ServiceInvokeFailed | Failed to invoke service. | 调用内部服务失败。 |
| 400 | ConfigParentExceedLimit | Config parent exceed limit. | 已引用的高级条件规则超过阈值。 |
| 400 | Function.InvalidParentId | The specified parentId does not exist. | 指定的规则条件不存在 |
| 400 | BatchSetBusinessError | some configs error:%s | 发生配置错误:%s |
| 400 | ConfigDuplicate | Duplicate configuration. This function has already been configured and cannot be added repeatedly. | 配置重复,该功能已经存在配置,不允许重复添加。 |
| 400 | FunctionArgError | The function parameter of the domain configuration is incorrect. |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。