tencent cloud

文档反馈

ModifyRule

最后更新时间:2024-04-09 10:25:26

    1. API Description

    Domain name for API request: teo.tencentcloudapi.com.

    This API is used to modify a rule in the rule engine.

    A maximum of 20 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common Params. The value used for this API: ModifyRule.
    Version Yes String Common Params. The value used for this API: 2022-09-01.
    Region No String Common Params. This parameter is not required.
    ZoneId Yes String ID of the site
    RuleName Yes String The rule name. It is a string that can contain 1–255 characters.
    Rules.N Yes Array of Rule The rule content.
    RuleId Yes String The rule ID.
    Status Yes String Rule status. Values:
  • enable: Enabled
  • disable: Disabled
  • Tags.N No Array of String Tag of the rule.

    3. Output Parameters

    Parameter Name Type Description
    RuleId String Rule ID
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 ModifyRule

    The following example shows common modifications.

    Input Example

    POST / HTTP/1.1
    Host: teo.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: ModifyRule
    <Common request parameters>
    
    {
        "Status": "disable",
        "Rules": [
            {
                "Actions": [
                    {
                        "NormalAction": {
                            "Action": "RangeOriginPull",
                            "Parameters": [
                                {
                                    "Name": "Switch",
                                    "Values": [
                                        "on"
                                    ]
                                }
                            ]
                        }
                    },
                    {
                        "CodeAction": {
                            "Action": "StatusCodeCache",
                            "Parameters": [
                                {
                                    "Name": "CacheTime",
                                    "StatusCode": 200,
                                    "Values": [
                                        "20"
                                    ]
                                }
                            ]
                        }
                    },
                    {
                        "RewriteAction": {
                            "Action": "ResponseHeader",
                            "Parameters": [
                                {
                                    "Action": "set",
                                    "Name": "Foo",
                                    "Values": [
                                        "Bar"
                                    ]
                                },
                                {
                                    "Action": "add",
                                    "Name": "Hello",
                                    "Values": [
                                        "World"
                                    ]
                                },
                                {
                                    "Action": "del",
                                    "Name": "Foo2",
                                    "Values": [
                                        ""
                                    ]
                                }
                            ]
                        }
                    }
                ],
                "Conditions": [
                    {
                        "Conditions": [
                            {
                                "Operator": "equal",
                                "Target": "host",
                                "Values": [
                                    "www.shawndai.cn"
                                ]
                            }
                        ]
                    }
                ]
            }
        ],
        "RuleName": "new_rule02",
        "ZoneId": "zone-26r78x31ny86",
        "RuleId": "rule-djuqmq"
    }
    

    Output Example

    {
        "Response": {
            "RequestId": "811d2583-310c-41f4-b5e7-abe4074047d4",
            "RuleId": "rule-djuqmq"
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    InternalError.ConfigLocked The configuration is locked. Please unlock and try again.
    InternalError.SystemError Internal system error.
    InvalidParameter.CacheKeyQueryStringTooManyValue The query string has too many values.
    InvalidParameter.CertSystemError Internal error.
    InvalidParameter.CompressionInvalidAlgorithms Invalid compression algorithm.
    InvalidParameter.ErrActionUnsupportTarget The current conditions do not support the requested operation.
    InvalidParameter.ErrInvalidAction Invalid operation.
    InvalidParameter.ErrInvalidActionDuplicateAction Invalid operation: Duplicate operation configuration.
    InvalidParameter.ErrInvalidActionParam Invalid operation: Invalid parameter.
    InvalidParameter.ErrInvalidActionParamAction Invalid parameter "action".
    InvalidParameter.ErrInvalidActionParamDuplicateName Invalid parameter: Duplicate parameter names.
    InvalidParameter.ErrInvalidActionParamName Invalid value type for the parameter "action".
    InvalidParameter.ErrInvalidActionParamTooManyValues Invalid parameter: The parameter has too many values.
    InvalidParameter.ErrInvalidActionParamValue Invalid action.
    InvalidParameter.ErrInvalidActionType Invalid action type.
    InvalidParameter.ErrInvalidConditionHostTooManyWhenModifyOriginActionConfigured You can only configure one host matching type when modifying the origin.
    InvalidParameter.ErrInvalidConditionIgnoreCase Invalid condition: The letter case is ignored.
    InvalidParameter.ErrInvalidConditionNameBadName Invalid condition: Invalid parameter name.
    InvalidParameter.ErrInvalidConditionNameTargetNotSupportName Invalid condition: The match type is not supported by this parameter.
    InvalidParameter.ErrInvalidConditionValueBadRegular Invalid condition: Invalid regular expression for the parameter value.
    InvalidParameter.ErrInvalidConditionValueBadUrl Invalid parameter value "url".
    InvalidParameter.ErrInvalidConditionValueBadValue Invalid condition: The parameter value is invalid.
    InvalidParameter.ErrInvalidConditionValueBadValueContainFileNameExtension Invalid parameter value: File extension is not allowed.
    InvalidParameter.ErrInvalidConditionValueTooLongValue Invalid condition: The parameter value exceeds the limit.
    InvalidParameter.ErrInvalidConditionValueTooManyValues Invalid condition: The parameter value exceeds the limit.
    InvalidParameter.ErrInvalidConditionValueTooManyWildcard Invalid condition: Too many wildcards in the parameter.
    InvalidParameter.ErrInvalidElseWhenModifyOriginActionConfigured ELSE is not supported for origin server modification.
    InvalidParameter.ErrNilCondition Empty condition.
    InvalidParameter.GrpcRequireHttp2 To enable gRPC support, HTTP/2 support must be enabled as well.
    InvalidParameter.HostNotFound The domain name does not exist.
    InvalidParameter.InvalidAuthenticationTypeSecretKey Invalid key for token authentication.
    InvalidParameter.InvalidAuthenticationTypeSignParam Invalid token authentication parameter.
    InvalidParameter.InvalidAuthenticationTypeTimeFormat Invalid authentication token format.
    InvalidParameter.InvalidAuthenticationTypeTimeParam Invalid authentication token parameter.
    InvalidParameter.InvalidAwsRegion Invalid region. Please fill in a correct region of the third-party object storage service.
    InvalidParameter.InvalidBackupServerName Invalid secondary origin domain.
    InvalidParameter.InvalidCacheKey Invalid cache key.
    InvalidParameter.InvalidCacheKeyCookie Invalid cache key cookie.
    InvalidParameter.InvalidCacheKeyIgnoreCase Cases are ignored in the cache key.
    InvalidParameter.InvalidCacheKeyScheme Invalid cache key scheme.
    InvalidParameter.InvalidCacheTime Invalid node cache validity.
    InvalidParameter.InvalidClientIpHeaderName Invalid client IP request header.
    InvalidParameter.InvalidCosDomain Invalid origin-pull configuration. When OriginType is COS or AWS_S3, the origin address must be an object storage domain name.
    InvalidParameter.InvalidErrorPageRedirectUrl Invalid custom error page.
    InvalidParameter.InvalidHttpsCipherSuiteAndTlsVersion The cipher suite does not match the TLS version.
    InvalidParameter.InvalidHttpsHstsMaxAge Invalid HTTPS HSTS.
    InvalidParameter.InvalidIpv6Switch Invalid IPv6 settings.
    InvalidParameter.InvalidMaxAgeTime Invalid browser cache.
    InvalidParameter.InvalidOrigin Invalid origin server.
    InvalidParameter.InvalidParameter Invalid parameter.
    InvalidParameter.InvalidRangeOriginPull Invalid Range GETs.
    InvalidParameter.InvalidRequestHeaderName Invalid request header.
    InvalidParameter.InvalidRequestHeaderNameXff Invalid request header x-forwarded-for.
    InvalidParameter.InvalidRequestHeaderValue Invalid request header.
    InvalidParameter.InvalidResponseHeaderName Invalid response header.
    InvalidParameter.InvalidResponseHeaderValue Invalid response header.
    InvalidParameter.InvalidRuleEngineAction Invalid rule engine operation.
    InvalidParameter.InvalidRuleEngineNotFound The rule does not exist.
    InvalidParameter.InvalidRuleEngineTarget Invalid rule engine condition.
    InvalidParameter.InvalidRuleEngineTargetsExtension Invalid file extension in the rule engine condition.
    InvalidParameter.InvalidRuleEngineTargetsUrl Invalid URL in the rule engine condition.
    InvalidParameter.InvalidServerName Invalid origin domain.
    InvalidParameter.InvalidUpstreamRequestQueryStringValue Origin-pull request configuration error: Invalid query string.
    InvalidParameter.InvalidUrlRedirectHost Invalid target host in the URL rewriting rule.
    InvalidParameter.InvalidUrlRedirectUrl The target URL for URL rewrite is invalid.
    InvalidParameter.KeyRulesInvalidQueryStringValue Invalid cache key.
    InvalidParameter.LoadBalanceInstanceIdIsRequired The Cloud Load Balancer instance ID is required in the operation of modifying the origin server.
    InvalidParameter.NotSupportThisPreset Unsupported preset variables exist.
    InvalidParameter.OriginOriginGroupIdIsRequired The origin group ID is required.
    InvalidParameter.OriginPullProtocolIsRequired The return protocol is required in the operation of modifying the origin server.
    InvalidParameter.PostMaxSizeLimitExceeded Maximum upload size exceeded.
    InvalidParameter.ResponseHeaderCacheControlNotAllowDelete Invalid response header.
    InvalidParameter.StatusCodeCacheInvalidStatusCode Invalid status code in cache.
    InvalidParameter.TlsVersionNotInSequence TLS version is not continuous for HTTPS.
    LimitExceeded The quota limit has been reached.
    OperationDenied Operation denied.
    OperationDenied.ConfigLocked The configuration is locked. Please unlock and try again.
    OperationDenied.ErrZoneIsAlreadyPaused The EdgeOne service of the site is disabled. Please enable it and try again.
    OperationDenied.InvalidAdvancedDefenseSecurityType The security service must be enabled when you enable the DDoS Protection.
    ResourceInUse The resource is occupied.
    UnauthorizedOperation.CamUnauthorized CAM is not authorized.
    UnauthorizedOperation.Unknown An unknown error occurred in the backend server.