CreateListener

1. API Description

This API is used to create TCP, UDP, or TCPSSL listeners in a load balancer.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

loadBalancerId

Yes

String

Load balance instance ID.

listenerName

Yes

String

Listener name. This parameter can contain up to 64 characters. Only letters, numbers, - and periods (.) are supported.

portList

Yes

Array of Integer

Listening ports.

Value range: 0~65535. Example value: ["6569"]

clientToken

Yes

String

Used to ensure the idempotency of the request.

protocol

Yes

String

Listening protocols.

Available values:

  • TCP

  • UDP

backendProtocol

Yes

String

Backend forwarding protocol.

Available values:

  • TCP

  • UDP

scheduler

No

String

Scheduling algorithm.

Available values:

  • wrr (default): Weighted round robin, the higher the weight value of the backend server, the higher the probability of being polled.

  • rr: Round robin, distribute external requests to backend servers in the order of access.

kind

No

String

Forwarding modes.

Available values:

  • FNAT (Global Network Address Translation)

  • DR (Direct Routing)

healthCheck

No

Information on the health check.

notify

No

Alarm.

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

listenerId

String

The listener ID.

4. Code Example

Create a listener.

POST /api/v2/bmc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: CreateListener
<Common Request Params>

Request:
{
  "loadBalancerId": "xxxx",
  "name": "xxxx",
  "portList": [80],
  "clientToken": "xxxx",
  "protocol": "TCP",
  "backendProtocol": "TCP"
}

Response:
{
  "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
  "response": {
    "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
    "listenerId": "xxxx"
  }
}

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

No error codes related to the API business logic. For other error codes, see Common Error Codes.​

Last updated