DescribeListeners

Last updated: 2020-10-16 18:26:19

1. API Description

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

This API is used to get the list of listeners by CLB instance ID, listener protocol, or port. If no filter is specified, all listeners under the CLB instance will be returned.

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

Note: This API supports Finance regions. If the common parameter Region is a Finance region, a domain name with the Finance region needs to be specified, for example: clb.ap-shanghai-fsi.tencentcloudapi.com

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: DescribeListeners.
Version Yes String Common parameter. The value used for this API: 2018-03-17.
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
LoadBalancerId Yes String CLB instance ID
ListenerIds.N No Array of String Array of IDs of the CLB listeners to be queried
Protocol No String Type of the listener protocol to be queried. Value range: TCP, UDP, HTTP, HTTPS, TCP_SSL
Port No Integer Port of the listener to be queried

3. Output Parameters

Parameter Name Type Description
Listeners Array of Listener List of listeners
TotalCount Integer Total number of listeners
Note: this field may return null, indicating that no valid values can be obtained.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Querying listeners by port, protocol, and listener ID

Input Example

https://clb.tencentcloudapi.com/?Action=DescribeListeners
&LoadBalancerId=lb-aniq7ewx
&Protocol=TCP
&Port=333
&ListenerIds.0=lbl-pt4dgkjn
&<Common request parameters>

Output Example

{
  "Response": {
    "Listeners": [
      {
        "ListenerId": "lbl-pt4dgkjn",
        "ListenerName": "333",
        "Protocol": "TCP",
        "Port": 333,
        "HealthCheck": {
          "HealthSwitch": 1,
          "TimeOut": 2,
          "IntervalTime": 5,
          "HealthNum": 3,
          "UnHealthNum": 3,
          "CheckPort": null,
          "CheckType": "TCP",
          "HttpCheckDomain": null,
          "HttpCheckPath": null,
          "HttpCheckMethod": null,
          "HttpVersion": null,
          "HttpCode": null,
          "ContextType": null,
          "SendContext": null,
          "RecvContext": null
        },
        "Certificate": null,
        "Scheduler": "WRR",
        "SessionExpireTime": 0,
        "SniSwitch": 0,
        "Rules": null
      }
    ],
    "RequestId": "0dc33bce-5fe5-4ce0-9734-d8212c258d36"
  }
}

Example2 Querying the information of all listeners in a CLB instance

Input Example

https://clb.tencentcloudapi.com/?Action=DescribeListeners
&LoadBalancerId=lb-aniq7ewx
&<Common request parameters>

Output Example

{
  "Response": {
    "Listeners": [
      {
        "ListenerId": "lbl-mdam9r0l",
        "ListenerName": "ds",
        "Protocol": "HTTPS",
        "Port": 1,
        "HealthCheck": null,
        "Certificate": {
          "SSLMode": "UNIDIRECTIONAL",
          "CertId": "V0ODELy7",
          "CertCaId": ""
        },
        "Scheduler": null,
        "SessionExpireTime": null,
        "SniSwitch": 0,
        "Rules": [
          {
            "ListenerId": "lbl-mdam9r0l",
            "LocationId": "loc-33laioar",
            "Domain": "4.com",
            "Url": "/df",
            "Certificate": null,
            "HealthCheck": {
              "HealthSwitch": 1,
              "TimeOut": 2,
              "IntervalTime": 5,
              "HealthNum": 3,
              "UnHealthNum": 3,
              "HttpCode": 15,
              "HttpCheckPath": "/",
              "HttpCheckDomain": "4.com",
              "HttpCheckMethod": "get",
              "CheckPort": null,
              "CheckType": null,
              "HttpVersion": null,
              "ContextType": null,
              "SendContext": null,
              "RecvContext": null
            },
            "RewriteTarget": {
              "TargetListenerId": null,
              "TargetLocationId": null
            },
            "SessionExpireTime": 0,
            "Scheduler": "WRR",
            "HttpGzip": true,
            "BeAutoCreated": false,
            "DefaultServer": false,
            "Http2": false,
            "ForwardType": "HTTP"
          }
        ]
      },
      {
        "ListenerId": "lbl-pt4dgkjn",
        "ListenerName": "333",
        "Protocol": "TCP",
        "Port": 333,
        "HealthCheck": {
          "HealthSwitch": 1,
          "TimeOut": 2,
          "IntervalTime": 5,
          "HealthNum": 3,
          "UnHealthNum": 3,
          "CheckPort": null,
          "CheckType": "TCP",
          "HttpCheckDomain": null,
          "HttpCheckPath": null,
          "HttpCheckMethod": null,
          "HttpVersion": null,
          "HttpCode": null,
          "ContextType": null,
          "SendContext": null,
          "RecvContext": null
        },
        "Certificate": null,
        "Scheduler": "WRR",
        "SessionExpireTime": 0,
        "SniSwitch": 0,
        "Rules": null
      }
    ],
    "RequestId": "a031471a-332d-4c45-a123-0bc6fb212780"
  }
}

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.
InternalError Internal error.
InvalidParameter Parameter error.
InvalidParameter.FormatError Wrong parameter format.
InvalidParameter.LBIdNotFound Wrong CLB instance ID.
InvalidParameterValue Incorrect parameter value.
InvalidParameterValue.Length Wrong parameter length.
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