Configures multiple accelerated domain names at a time.

Note
  • You can call this operation up to 30 times per second per account.
  • You can specify multiple domain names and must separate them with commas (,). You can specify up to 50 domain names in each call.
  • If the BatchSetCdnDomainConfig operation is successful, a unique configuration ID (ConfigId) is generated. You can use configuration IDs to update or delete configurations. For more information, see Usage notes on ConfigId.

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 BatchSetCdnDomainConfig

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

DomainNames String Yes www.example.com

The accelerated domain name. Separate multiple accelerated domain names with commas (,).

Functions String Yes [{"functionArgs": [{"argName": "key","argValue": "Content-Encoding"},{"argName": "value","argValue": "gzip"}],"functionName": "set_resp_header"} ]

The features that you want to configure. Format:

  • functionName: the name of the feature. This parameter is required. Separate multiple values with commas (,). For more information, see A list of features.
  • argName: the feature parameter for functionName. This parameter is required. You can specify multiple feature parameters.
  • argValue: the parameter value that is specified for functionName. This parameter is required.
  • parentid: the rule condition ID. This parameter is optional. You can use the condition rule engine to create a rule condition. For information, see BatchSetCdnDomainConfig and SetCdnDomainStagingConfig. A rule condition can identify parameters that are included in requests and filter requests based on the identified parameters. After you create a rule condition, a configid is generated. configid can be used as parentId that is referenced by other features. This way, you can combine rule conditions and features for flexible configurations.

If you set parentId to -1, the existing rule conditions in the configurations are deleted.

[{
   "functionArgs": [{
     "argName": "Parameter A", 
     "argValue": Value of parameter A"
    }, 
  {
    "argName": "Parameter B", 
    "argValue": "Value of parameter B"
     }], 
 "functionName": "Feature name"
 "parentId": "Optional, which corresponds to configid of the referenced rule condition"
}]

The following code shows a sample configuration if parentId is not used.

In this example, the origin_request_header feature is used to add back-to-origin HTTP headers, and the rule condition whose configuration ID is 222728944812032 is referenced.

[{
        "functionArgs": [{
            "argName": "header_operation_type",
            "argValue": "add"
        }, {
            "argName": "header_name",
            "argValue": "Accept-Encoding"
        }, {
            "argName": "header_value",
            "argValue": "gzip"
        }, {
            "argName": "duplicate",
            "argValue": "off"
        }],
        "functionName": "origin_request_header"
}]

The following code shows a sample configuration if parentId is used.

In this example, the origin_request_header feature is used to add back-to-origin HTTP headers, and the rule condition whose configuration ID is 222728944812032 is referenced.

[{
        "functionArgs": [{
            "argName": "header_operation_type",
            "argValue": "add"
        }, {
            "argName": "header_name",
            "argValue": "Accept-Encoding"
        }, {
            "argName": "header_value",
            "argValue": "gzip"
        }, {
            "argName": "duplicate",
            "argValue": "off"
        }],
        "functionName": "origin_request_header",
        "parentId": "222728944812032"
}]

Response parameters

Parameter Type Example Description
RequestId String 04F0F334-1335-436C-A1D7-6C044FE73368

The ID of the request.

DomainConfigList Array of DomainConfigModel

The list of domain configurations.

DomainConfigModel
ConfigId Long 1234567

The ID of the configuration.

DomainName String www.example.com

The domain name.

FunctionName String set_resp_header

The name of the feature.

Examples

Sample requests

http://cdn.aliyuncs.com/?Action=BatchSetCdnDomainConfig
&DomainName=www.example.com
&Functions=[{"functionArgs": [{"argName": "key","argValue": "Content-Encoding"},{"argName": "value","argValue": "gzip"}],"functionName": "set_resp_header"} ]
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<BatchSetCdnDomainConfigResponse>
<RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
<DomainConfigModel>
    <DomainName>www.example.com</DomainName>
    <ConfigId>1234567</ConfigId>
    <FunctionName>set_resp_header</FunctionName>
</DomainConfigModel>
</BatchSetCdnDomainConfigResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "04F0F334-1335-436C-A1D7-6C044FE73368",
  "DomainConfigModel" : [ {
    "DomainName" : "www.example.com",
    "ConfigId" : 1234567,
    "FunctionName" : "set_resp_header"
  } ]
}

Error codes

HTTP status code Error code Error message Description
400 InvalidFunctions.Malformed The specified Functions is incorrectly formatted. The error message returned because the value that is specified for the Functions parameter is in an invalid format.
400 InvalidArgValue.Malformed The specified ArgValue is invalid. The error message returned because the value that is specified for the argValue parameter is in an invalid format. Specify the parameter in a valid format and try again.
400 MissingParameter%s The specified value of ArgName[%s] is missing. The error message returned because you did not specify the argName parameter.
400 InvalidFunctionArgs.Malformed The specified FunctionArgs is invalid. The error message returned because the value that is specified for the FunctionName parameter is in an invalid format.
400 InvalidHeaderKey.ValueNotSupported The specified value of parameter HeaderKey is not supported. The error message returned because the specified HTTP header is invalid. Valid values of the Key parameter: 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, and Access-Control-Allow-Credentials.
400 ConfigurationConflicts The staging environment has a configuration in effect and cannot modify the production environment configuration. The error message returned because the configurations of the staging environment are different from those of the production environment. You cannot directly modify the configurations of the production environment. You must modify the configurations in the staging environment, and then publish the configurations to the production environment.
400 InvalidFunction.NotSupported The domain is not supported to set the function. The error message returned because the feature is not supported by the domain name.
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 The error message returned because you do not have the permissions to create service-linked roles. You must contact the owner of the Alibaba Cloud account or the permission administrator to attach the AliyunCDNFullAccess policy to you or attach a custom policy to you so that you can have the permissions to create service-linked roles. Information about the custom policy: Service name: cdn-ddos.cdn.aliyuncs.com. Name of the service-linked role: AliyunServiceRoleForCDNAccessingDDoS. Required permission: ram:CreateServiceLinkedRole.

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