# CreateNLBListener - CreateNLBListener

## Overview

Create NLB Listener






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `CreateNLBListener`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.surfercloud.com/uaccount/api_manage)                                             | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Region** | string | Region. See [Region and Zone List](/docs/api/summary/regionlist) |**Yes**|
| **ProjectId** | string | Project ID. Leave it blank for the default project. Sub-accounts must fill in. Please refer to the [GetProjectList API](/docs/api/summary/get_project_list) |No|
| **NLBId** | string | ID of the Network Load Balance  |**Yes**|
| **Protocol** | string | Monitoring Protocol<br />Limited values: "TCP"/"UDP". |**Yes**|
| **HealthCheckConfig.Port** | int | Health Check Detection Port Description: Limited Value Range: [1-65535] |**Yes**|
| **HealthCheckConfig.Enabled** | boolean | Whether to enable the health check function. Temporarily does not support closing, default is true. |No|
| **HealthCheckConfig.Type** | string | Health Check Method Limited Values: "Port"/"UDP"/"Ping"/"HTTP" Default Value: "Port |No|
| **HealthCheckConfig.ReqMsg** | string | Request string for UDP check mode |No|
| **HealthCheckConfig.ResMsg** | string | Expected response string for "UDP" check mode |No|
| **Name** | string | Name of the listener<br />Character length limit: [1-255]<br />Special characters allowed: -_.<br />Default value: listener |No|
| **Remark** | string | Remarks for the listener<br />Character length limit: [0-255] |No|
| **StartPort** | int | Start port of the port range<br />Limited value: [1-65535]<br />Default value 1 |No|
| **EndPort** | int | End port of the port range<br />Limited value: [1-65535]<br />The value is not less than the start port<br />Default value 65535 |No|
| **Scheduler** | string | Load Balancing Algorithm<br />Limited values: "RoundRobin"/"SourceHash"/"LeastConn"/"WeightLeastConn "/"WeightRoundRobin"<br />Default value "RoundRobin"  |No|
| **StickinessTimeout** | int | Session keep-alive timeout. Unit: seconds<br />Limited value range: [60-900], 0 means session keep-alive is not enabled<br />Default value 60 |No|
| **ForwardSrcIPMethod** | string | Method of Passing Source IP<br />Limited values: "" / "None" / "Toa", both empty string and None represent turning off. |No|

### Response Field

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RetCode** | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. |**Yes**|
| **Action** | string | Operation command name. |**Yes**|
| **Message** | string | Returns an error message, providing detailed description when `RetCode` is non-zero. |No|
| **ListenerId** | string | Listener's ID |**Yes**|




## Example

### Request Example
    
```
https://api.surfercloud.com/?Action=CreateNLBListener
&Region=cn-zj
&Zone=cn-zj-01
&ProjectId=MARULUOv
&NLBId=GNvXptgc
&Name=LtMcdpyQ
&Remark=urkacxDK
&StartPort=5
&EndPort=4
&Protocol=vfTQAfIi
&Scheduler=mYCNnjfx
&StickinessTimeout=7
&HealthCheckConfig=WHmazuVn
&HealthCheckConfig.Port=7
&HealthCheckConfig.Type=OTsPFkqI
&HealthCheckConfig.Interval=3
&HealthCheckConfig.MinSuccess=8
&HealthCheckConfig.MaxFail=5
&HealthCheckConfig.ReqMsg=AQIXJQZS
&HealthCheckConfig.ResMsg=bBBpmaEy
&ForwardSrcIPMethod=aRYJWQFx
```

### Response Example
    
```json
{
  "Action": "CreateNLBListenerResponse",
  "ListenerId": "WVmnGcQN",
  "RetCode": 0
}
```





