Last updated: 2021-04-12 11:41:59

1. API Description

Domain name for API request:

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

This example shows you how to create an HTTP/HTTPS listener forwarding rule.

Input Example
&<Common request parameters>

Output Example

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

5. Developer Resources


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
AuthFailure.NotEnterpriseAuthorization Not an organizational customer.
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.