Domain name for API request: teo.tencentcloudapi.com.
This API is used to create a rule in the rule engine.
A maximum of 20 requests can be initiated per second for this API.
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: CreateRule. |
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 (1 to 255 characters) |
Status | Yes | String | Rule status. Values:enable : Enableddisable : Disabled |
Rules.N | Yes | Array of Rule | The rule content. |
Tags.N | No | Array of String | Tag of the rule. |
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. |
This example shows you how to create a rule engine.
POST / HTTP/1.1
Host: teo.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateRule
<Common request parameters>
{
"Status": "disable",
"Rules": [
{
"Actions": [
{
"NormalAction": {
"Action": "RangeOriginPull",
"Parameters": [
{
"Name": "Switch",
"Values": [
"on"
]
}
]
}
},
{
"CodeAction": {
"Action": "StatusCodeCache",
"Parameters": [
{
"Name": "CacheTime",
"StatusCode": 400,
"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": [
"test.vernayang.com"
]
}
]
}
]
}
],
"RuleName": "new_rule01",
"ZoneId": "zone-qbjifysd"
}
{
"Response": {
"RequestId": "811d2583-310c-41f4-b5e7-abe4074047d4",
"RuleId": "rule-djuqmq"
}
}
This example shows you how to change the origin server type to IP domain name using the rule engine.
POST / HTTP/1.1
Host: teo.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateRule
<Common request parameters>
{
"ZoneId": "zone-2kmrcz5heaw2",
"RuleName": "test_origin",
"Status": "enable",
"Rules": [
{
"Conditions": [
{
"Conditions": [
{
"Operator": "equal",
"Target": "host",
"IgnoreCase": false,
"Values": [
"rule.test.cloud"
]
},
{
"Operator": "equal",
"Target": "client_country",
"IgnoreCase": false,
"Values": [
"CN"
]
}
]
}
],
"Actions": [
{
"NormalAction": {
"Action": "Origin",
"Parameters": [
{
"Name": "Type",
"Values": [
"IP_DOMAIN"
]
},
{
"Name": "DomainName",
"Values": [
"1.1.1.1"
]
},
{
"Name": "OriginProtocol",
"Values": [
"follow"
]
},
{
"Name": "HttpOriginPort",
"Values": [
"80"
]
},
{
"Name": "HttpsOriginPort",
"Values": [
"443"
]
}
]
}
}
],
"SubRules": []
}
]
}
{
"Response": {
"RuleId": "rule-djuqsx",
"RequestId": "811d2583-310c-41f4-b5e7-abe4074047d4"
}
}
This example shows you how to change the origin server type to origin server group using the rule engine.
POST / HTTP/1.1
Host: teo.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateRule
<Common request parameters>
{
"ZoneId": "zone-2kmrcz5heaw2",
"RuleName": "test_origin",
"Status": "enable",
"Rules": [
{
"Conditions": [
{
"Conditions": [
{
"Operator": "equal",
"Target": "host",
"IgnoreCase": false,
"Values": [
"rule.test.cloud"
]
},
{
"Operator": "equal",
"Target": "client_country",
"IgnoreCase": false,
"Values": [
"CN"
]
}
]
}
],
"Actions": [
{
"NormalAction": {
"Action": "Origin",
"Parameters": [
{
"Name": "Type",
"Values": [
"OriginGroup"
]
},
{
"Name": "OriginGroupId",
"Values": [
"origin-ff7e677b-2c4d-11ee-9687-525400521111"
]
},
{
"Name": "OriginProtocol",
"Values": [
"follow"
]
},
{
"Name": "HttpOriginPort",
"Values": [
"80"
]
},
{
"Name": "HttpsOriginPort",
"Values": [
"443"
]
}
]
}
}
],
"SubRules": []
}
]
}
{
"Response": {
"RuleId": "rule-djuq9s",
"RequestId": "811d2583-310c-41f4-b5e7-abe407404sdsd"
}
}
This example shows you how to change the origin server type to load balancing using the rule engine.
POST / HTTP/1.1
Host: teo.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateRule
<Common request parameters>
{
"ZoneId": "zone-2kmrcz5heaw2",
"RuleName": "test_origin",
"Status": "enable",
"Rules": [
{
"Conditions": [
{
"Conditions": [
{
"Operator": "equal",
"Target": "host",
"IgnoreCase": false,
"Values": [
"rule.test.cloud"
]
},
{
"Operator": "equal",
"Target": "client_country",
"IgnoreCase": false,
"Values": [
"CN"
]
}
]
}
],
"Actions": [
{
"NormalAction": {
"Action": "Origin",
"Parameters": [
{
"Name": "Type",
"Values": [
"LoadBalance"
]
},
{
"Name": "OriginGroupId",
"Values": [
"lb-ff7e677b-2c4d-11ee-9687"
]
},
{
"Name": "OriginProtocol",
"Values": [
"follow"
]
},
{
"Name": "HttpOriginPort",
"Values": [
"80"
]
},
{
"Name": "HttpsOriginPort",
"Values": [
"443"
]
}
]
}
}
],
"SubRules": []
}
]
}
{
"Response": {
"RuleId": "rule-djuq91",
"RequestId": "811d2583-310c-41f4-b5e7-abe407404xs"
}
}
This example shows you how to change the origin server type to S3-compatible object storage using the rule engine.
POST / HTTP/1.1
Host: teo.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateRule
<Common request parameters>
{
"ZoneId": "zone-2kmrcz5heaw2",
"RuleName": "test_origin",
"Status": "enable",
"Rules": [
{
"Conditions": [
{
"Conditions": [
{
"Operator": "equal",
"Target": "host",
"IgnoreCase": false,
"Values": [
"rule.test.cloud"
]
},
{
"Operator": "equal",
"Target": "client_country",
"IgnoreCase": false,
"Values": [
"CN"
]
}
]
}
],
"Actions": [
{
"NormalAction": {
"Action": "Origin",
"Parameters": [
{
"Name": "Type",
"Values": [
"AWS_S3"
]
},
{
"Name": "ServerName",
"Values": [
"bucke_name.gcp.storage.com"
]
},
{
"Name": "PrivateAccess",
"Values": [
"on"
]
},
{
"Name": "AccessKeyId",
"Values": [
"xxxx******xxxx"
]
},
{
"Name": "SecretAccessKey",
"Values": [
"xxxx******xxxx"
]
},
{
"Name": "SignatureVersion",
"Values": [
"v4"
]
},
{
"Name": "Region",
"Values": [
"ap-guangzhou"
]
}
]
}
}
],
"SubRules": []
}
]
}
{
"Response": {
"RuleId": "rule-djuq23",
"RequestId": "811d2583-310c-41f4-b5e7-abe407404sxsd"
}
}
This example shows you how to change the origin server type to COS using the rule engine.
POST / HTTP/1.1
Host: teo.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateRule
<Common request parameters>
{
"ZoneId": "zone-2kmrcz5heaw2",
"RuleName": "test_origin",
"Status": "enable",
"Rules": [
{
"Conditions": [
{
"Conditions": [
{
"Operator": "equal",
"Target": "host",
"IgnoreCase": false,
"Values": [
"rule.test.cloud"
]
},
{
"Operator": "equal",
"Target": "client_country",
"IgnoreCase": false,
"Values": [
"CN"
]
}
]
}
],
"Actions": [
{
"NormalAction": {
"Action": "Origin",
"Parameters": [
{
"Name": "Type",
"Values": [
"COS"
]
},
{
"Name": "ServerName",
"Values": [
"bucke_name.gcp.storage.com"
]
},
{
"Name": "CosPrivateAccess",
"Values": [
"on"
]
}
]
}
}
],
"SubRules": []
}
]
}
{
"Response": {
"RuleId": "rule-djuq21",
"RequestId": "811d2583-310c-41f4-b5e7-abe407404hs"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
FailedOperation | Operation failed. |
InternalError.ConfigLocked | The configuration is locked. Please unlock and try again. |
InternalError.ProxyServer | An unknown error occurred in the backend server. |
InternalError.SystemError | Internal system error. |
InvalidParameter.AccessRedirectRegexError | The regex is not in the standard RE2 format. |
InvalidParameter.ActionInProgress | Too many attempts. Please try again later. |
InvalidParameter.CertSystemError | Internal error. |
InvalidParameter.ErrActionUnsupportTarget | The current conditions do not support the requested operation. |
InvalidParameter.ErrInvalidAction | Invalid operation. |
InvalidParameter.ErrInvalidActionOriginPrivateAddress | Invalid rule engine operation. The origin server IP cannot be a private network IP or loopback address. |
InvalidParameter.ErrInvalidActionParam | Invalid operation: Invalid parameter. |
InvalidParameter.ErrInvalidActionParamAction | Invalid parameter "action". |
InvalidParameter.ErrInvalidActionParamBadValueType | Invalid value type for the parameter "action". |
InvalidParameter.ErrInvalidActionParamDuplicateName | Invalid parameter: Duplicate parameter names. |
InvalidParameter.ErrInvalidActionParamName | Invalid value type for the parameter "action". |
InvalidParameter.ErrInvalidActionParamValue | Invalid action. |
InvalidParameter.ErrInvalidActionType | Invalid action type. |
InvalidParameter.ErrInvalidCondition | Invalid conditions. |
InvalidParameter.ErrInvalidConditionCannotOnlyContainHostWhenModifyOriginActionConfigured | The operations of modifying the origin server cannot be only to configure host matching type. |
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.ErrInvalidConditionValueTooManyRegular | The condition has too many regular expressions. |
InvalidParameter.ErrInvalidConditionValueTooManyValues | Invalid condition: The parameter value exceeds the limit. |
InvalidParameter.ErrInvalidConditionValueTooManyWildcard | Invalid condition: Too many wildcards in the parameter. |
InvalidParameter.ErrInvalidConditionValueZeroLength | Invalid condition: The parameter value is 0. |
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.InvalidAuthentication | Invalid token authentication. |
InvalidParameter.InvalidAuthenticationTypeExpireTime | Invalid token authentication expiration time. |
InvalidParameter.InvalidAuthenticationTypeSignParam | Invalid token authentication 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.InvalidCacheConfigCache | Invalid node cache. |
InvalidParameter.InvalidCacheKey | Invalid cache key. |
InvalidParameter.InvalidCacheKeyQueryStringValue | Invalid query string. |
InvalidParameter.InvalidCacheTime | Invalid node cache validity. |
InvalidParameter.InvalidClientIpHeaderName | Invalid client IP request header. |
InvalidParameter.InvalidDynamicRoutine | Invalid smart acceleration. |
InvalidParameter.InvalidDynamicRoutineBilling | The package does not support Smart Acceleration. |
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.InvalidPostSizeValue | Invalid POST request size. |
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.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.InvalidStandardDebugExpireTimeLimit | The expiration time is exceeded. |
InvalidParameter.InvalidUpstreamRequestQueryStringValue | Origin-pull request configuration error: Invalid query string. |
InvalidParameter.InvalidUrlRedirect | Invalid URL rewrite. |
InvalidParameter.InvalidUrlRedirectHost | Invalid target host in the URL rewriting rule. |
InvalidParameter.InvalidUrlRedirectUrl | The target URL for URL rewrite is invalid. |
InvalidParameter.InvalidWebSocketTimeout | Invalid WebSocket. |
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.PostMaxSizeLimitExceeded | Maximum upload size exceeded. |
InvalidParameter.TaskSystemError | Internal error. |
InvalidParameterValue.FormatMismatch | Format mismatch. |
InvalidParameterValue.GeneralMismatch | Configuration parameter format mismatch. |
InvalidParameterValue.IncludeInvalidValue | Contains invalid value. |
InvalidParameterValue.MissingNecessaryParam | Missing required configuration parameters. |
InvalidParameterValue.NotInEnumeration | The value is not within the required collection. |
InvalidParameterValue.NotWithinRange | The value is not within the specified range. |
InvalidParameterValue.RegExMismatch | Does not match the specified regular expression. |
InvalidParameterValue.UnrecognizableValue | Configuration item error. |
LimitExceeded | The quota limit has been reached. |
OperationDenied | Operation denied. |
OperationDenied.AccelerateMainlandMultiplyLayerConflict | The existing domain feature under the current site conflicts with the Chinese mainland network optimization, and cannot be configured at the same time. |
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. |
本页内容是否解决了您的问题?