CreateRule

Last updated: 2020-09-25 14:26:32

1. API Description

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

This API (CreateRule) is used to create the forwarding rules of HTTP/HTTPS listeners.

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 parameter. The value used for this API: CreateRule.
Version Yes String Common parameter. The value used for this API: 2018-05-29.
Region No String Common parameter. This parameter is not required for this API.
ListenerId Yes String Layer-7 listener ID
Domain Yes String Domain name of the forwarding rule
Path Yes String Path of the forwarding rule
RealServerType Yes String The origin server type of the forwarding rule, which supports IP and DOMAIN types.
Scheduler Yes String Forwarding rules of origin server, which supports round robin (rr), weighted round robin (wrr), and least connections (lc).
HealthCheck Yes Integer Whether the health check is enabled for rules. 1: enabled; 0: disabled.
CheckParams No RuleCheckParams Parameters related to origin server health check
ForwardProtocol No String Protocol types of the forwarding from acceleration connection to origin server, which supports HTTP or HTTPS.
If this field is not passed in, it indicates that the ForwardProtocol of the corresponding listener will be used.
ForwardHost No String Remote host to which the acceleration connection forwards. If this parameter is not specified, the default host will be used, i.e., the host with which the client initiates HTTP requests.

3. Output Parameters

Parameter Name Type Description
RuleId String The ID of the successfully created forwarding rule
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Creating a Listener Forwarding Rule

Create an HTTP/HTTPS listener forwarding rule.

Input Example

https://gaap.tencentcloudapi.com/?Action=CreateRule
&RealServerType=IP
&ListenerId=listener-9jt0rtv9
&Scheduler=rr
&Path=%2Fimage
&CheckParams.StatusCode.0=100
&CheckParams.StatusCode.2=200
&CheckParams.StatusCode.1=300
&CheckParams.StatusCode.3=400
&CheckParams.StatusCode.4=500
&CheckParams.DelayLoop=39
&CheckParams.Path=%2F
&CheckParams.Method=HEAD
&CheckParams.ConnectTimeout=4
&Language=zh-CN
&HealthCheck=1
&Domain=www.bbb.com
&<Common request parameters>

Output Example

{
  "Response": {
    "RequestId": "f3ab4984-dfe0-4c6f-aca0-32100550f6fd",
    "RuleId": "rule-qws4fmyl"
  }
}

5. Developer Resources

API Explorer

This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

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
FailedOperation Operation failed.
FailedOperation.InstanceStatusNotInRuning Unable to operate: the connection is not running.
FailedOperation.LimitNumofRules Limit on the number of forwarding rules exceeded.
FailedOperation.ListenerHasTask The listener is in operation. Do not repeat the operation.
FailedOperation.NotSupportOldVersionProxy Only connections of Version 2.0 are supported.
FailedOperation.RuleAlreadyExisted Rule already exists.
InternalError Internal error.
InvalidParameter Incorrect parameter.
InvalidParameterValue Incorrect parameter value.
MissingParameter Missing parameter.
ResourceNotFound The resource does not exist.
UnauthorizedOperation Unauthorized operation.

Was this page helpful?

Was this page helpful?

  • Not at all
  • Not very helpful
  • Somewhat helpful
  • Very helpful
  • Extremely helpful
Send Feedback
Help