全部產品
Search
文件中心

:BatchSetCdnDomainConfig - 大量設定網域名稱

更新時間:Dec 01, 2025

調用BatchSetCdnDomainConfig進行網域名稱大量設定。

介面說明

  • 單使用者調用頻率:3 次/秒。

  • 支援大量設定網域名稱,多個網域名稱用半形逗號(,)分隔,一次最多支援配置 50 個網域名稱。

  • 調用 BatchSetCdnDomainConfig 給網域名稱配置某些功能後,將會產生唯一的 ConfigId,通過 ConfigId 可以完成更新和刪除配置操作。具體使用方法,請參見 ConfigId 使用與查詢

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

cdn:BatchSetCdnDomainConfig

update

*Domain

acs:cdn:*:{#accountId}:domain/{#DomainNames}

  • ram:CreateServiceLinkedRole

請求參數

名稱

類型

必填

描述

樣本值

DomainNames

string

加速網域名稱,多個網域名稱用半形逗號(,)分隔,注意以下配置限制:

  • 一次最多傳 50 個網域名稱。

  • 網域名稱個數乘以 Functions 個數,小於等於 50。

www.example.com

Functions

string

功能列表,一次傳入最多 50 條,格式如下:

  • functionName(功能名稱,必填):可配置功能請參見功能列表,多個參數之間用半形逗號(,)分隔。

  • argName(參數名稱,必填):functionName 的配置項(可配置多個配置項)。

  • argValue(參數值,必填):functionName 的配置項的取值。

  • parentid(規則條件 ID,非必填):通過配置網域名稱配置功能參數中的功能函數 condition(規則引擎),可以建立出規則條件(規則條件可以通過識別使用者請求中攜帶的各種參數來匹配和過濾使用者請求),每一個規則條件被建立以後都會產生一個對應的 configid ,configid 可以被當作 ParentId 參數被其他功能函數引用,這樣規則條件就可以與功能配置一起組合形成更靈活的配置。

parentId-1:表示刪除該配置裡面已有的規則條件。

   "functionArgs": [{
     "argName": "功能參數 A", 
     "argValue": "功能參數 A 對應的值"
    }, 
  {
    "argName": "功能參數 B", 
    "argValue": "功能參數 B 對應的值"
     }], 
 "functionName": "功能名稱",
 "parentId": 選填項,對應引用規則條件的 configid
}]

不使用 parentId 的情況下,配置樣本如下: 使用函數origin_request_header添加回源 HTTP 要求頭的時候引用了configid=222728944812032的規則條件,請求參數如下:

        "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 的情況下,配置樣本如下: 使用函數origin_request_header添加回源 HTTP 要求頭的時候引用了configid=222728944812032的規則條件,請求參數如下:

        "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
}]

對一個已經使用了 parentId 的功能配置刪除對 parentId 的引用,配置樣本如下: 函數origin_request_header添加回源 HTTP 要求頭的時候已經引用了configid=222728944812032的規則條件,現在要刪掉對規則條件的引用,請求參數如下:

        "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": -1
}]

[{"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.

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情