Configures multiple accelerated domain names at a time.

Note
  • The maximum number of times that each user can call this operation per second is 30.
  • You can specify multiple domain names and separate them with commas (,). You can specify at most 50 domain names in each call.
  • If the BatchSetCdnDomainConfig operation succeeds, 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 names. You can specify multiple accelerated domain names and separate them 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:

Note
  • functionName: The name of the feature. Separate multiple values with commas (,).
  • argName: The feature parameters for functionName.
  • argValue: The parameter values set for functionName.
    [
     {
       "functionArgs": [
        {
         "argName": "Parameter A", 
         "argValue": "Parameter value"
        }, 
      {
        "argName": "Parameter B", 
        "argValue": "Parameter value"
         }
     ], 
     "functionName": "Feature name"
        }
    ]

Response parameters

Parameter Type Example Description
DomainConfigList Array of DomainConfigModel

A list of 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.

RequestId String 04F0F334-1335-436C-A1D7-6C044FE73368

The ID of the request.

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

<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

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

Error codes

HttpCode Error code Error message Description
400 InvalidFunctions.Malformed The specified Functions is incorrectly formatted. The error message returned because the format of the configuration is invalid.
400 InvalidArgValue.Malformed The specified ArgValue is invalid. The error message returned because the parameter is set in an invalid format. Set 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 a required parameter is not set.
400 InvalidFunctionArgs.Malformed The specified FunctionArgs is invalid. The error message returned because the FunctionName parameter is set 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 configuration in the staging environment and then publish the configuration 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 permissions to create service-linked roles. You must contact the owner of the Alibaba Cloud account or permission administrator to acquire the AliyunCDNFullAccess permission or attach a custom permission policy to the service-linked role. Information about the permission policy:Service name: cdn-ddos.cdn.aliyuncs.com.Name of the service-linked role: AliyunServiceRoleForCDNAccessingDDoS.Required permissions: ram:CreateServiceLinkedRole.

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