Queries listeners.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListListeners

The operation that you want to perform. Set the value to ListListeners.

RegionId String Yes cn-hangzhou

The ID of the region where the Global Accelerator (GA) instance is deployed. Set the value to cn-hangzhou.

PageNumber Integer No 1

The number of the page to return. Default value: 1.

PageSize Integer No 10

The number of entries to return on each page. Maximum value: 50. Default value: 10.

AcceleratorId String Yes ga-bp1odcab8tmno0hdq****

The ID of the GA instance.

Response parameters

Parameter Type Example Description
TotalCount Integer 1

The total number of entries returned.

Listeners Array of Listeners

The information about the listeners.

Certificates Array of Certificate

The information about the SSL certificates.

Type String Server

The type of the certificate.

Only Server can be returned. The value Server indicates a server certificate.

Id String 44983xxxx-cn-hangzhou

The ID of the SSL certificate.

BackendPorts Array of BackendPort

The information about the ports that can be used by the backend server.

FromPort String 80

The start port that can be used by the backend server.

ToPort String 80

The end port that can be used by the backend server.

ListenerId String lsr-bp1bpn0kn908w4nbw****

The ID of the listener.

Description String Listener

The description of the listener.

State String active

The status of the listener. Valid values:

  • active: The listener is running as expected.
  • creating: The listener is being created.
  • configuring: The listener is being configured.
ClientAffinity String SOURCE_IP

Indicates whether client affinity is enabled for the listener.

  • Default value: NONE. The value NONE indicates that client affinity is disabled. In this case, requests from a specific client are not always routed to the same endpoint.
  • If SOURCE_IP is returned, client affinity is enabled. In this case, when a client connects to stateful applications, requests from the client are always routed to the same endpoint regardless of the source port or protocol.
Protocol String TCP

The network transmission protocol that is used by the listener. Valid values:

  • tcp
  • udp
  • http
  • https
Note You can create HTTP and HTTPS listeners only if your Alibaba Cloud account is added to the whitelist. To apply to add your Alibaba Cloud account to the whitelist, submit a ticket.
CreateTime Long 1577786252000

The timestamp when the listener was created.

PortRanges Array of PortRanges

The information about the listening ports.

FromPort Integer 20

The start listening port that is used to receive and forward requests to endpoints.

Note You can configure only one listening port for an HTTP or HTTPS listener. The start listening port also serves as the end listening port.
ToPort Integer 20

The end listening port that is used to receive and forward requests to endpoints.

Name String Listener

The name of the listener.

ProxyProtocol Boolean true

Indicates whether client IP addresses are reserved. Valid values:

  • true: Client IP addresses are reserved. The value true indicates that you can view the source IP addresses of clients from the backend server.
  • false: Client IP addresses are not reserved.
    Note This parameter will be deprecated from the API operations that are used to configure listeners. We recommend that you configure this parameter when you call API operations to configure endpoint groups. For more information about the ProxyProtocol parameter, see CreateEndpointGroup and UpdateEndpointGroup.
AcceleratorId String ga-bp1odcab8tmno0hdq****

The ID of the GA instance.

PageSize Integer 10

The number of entries returned per page.

RequestId String 6FEA0CF3-D3B9-43E5-A304-D217037876A8

The ID of the request.

PageNumber Integer 1

The page number of the returned page.

Examples

Sample requests

http(s)://[Endpoint]/?Action=ListListeners
&RegionId=cn-hangzhou
&PageNumber=1
&PageSize=10
&AcceleratorId=ga-bp1odcab8tmno0hdq****
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListListenersResponse>
    <TotalCount>1</TotalCount>
    <Listeners>
        <Certificates>
            <Type>Server</Type>
            <Id>44983xxxx-cn-hangzhou</Id>
        </Certificates>
        <BackendPorts>
            <FromPort>80</FromPort>
            <ToPort>80</ToPort>
        </BackendPorts>
        <ListenerId>lsr-bp1bpn0kn908w4nbw****</ListenerId>
        <Description>Listener</Description>
        <State>active</State>
        <ClientAffinity>SOURCE_IP</ClientAffinity>
        <Protocol>TCP</Protocol>
        <CreateTime>1577786252000</CreateTime>
        <PortRanges>
            <FromPort>20</FromPort>
            <ToPort>20</ToPort>
        </PortRanges>
        <Name>Listener</Name>
        <ProxyProtocol>true</ProxyProtocol>
        <AcceleratorId>ga-bp1odcab8tmno0hdq****</AcceleratorId>
    </Listeners>
    <PageSize>10</PageSize>
    <RequestId>6FEA0CF3-D3B9-43E5-A304-D217037876A8    </RequestId>
    <PageNumber>1</PageNumber>
</ListListenersResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "TotalCount" : 1,
  "Listeners" : [ {
    "Certificates" : [ {
      "Type" : "Server",
      "Id" : "44983xxxx-cn-hangzhou"
    } ],
    "BackendPorts" : [ {
      "FromPort" : "80",
      "ToPort" : "80"
    } ],
    "ListenerId" : "lsr-bp1bpn0kn908w4nbw****",
    "Description" : "Listener",
    "State" : "active",
    "ClientAffinity" : "SOURCE_IP",
    "Protocol" : "TCP",
    "CreateTime" : 1577786252000,
    "PortRanges" : [ {
      "FromPort" : 20,
      "ToPort" : 20
    } ],
    "Name" : "Listener",
    "ProxyProtocol" : true,
    "AcceleratorId" : "ga-bp1odcab8tmno0hdq****"
  } ],
  "PageSize" : 10,
  "RequestId" : "6FEA0CF3-D3B9-43E5-A304-D217037876A8\t",
  "PageNumber" : 1
}

Error codes

For a list of error codes, visit the API Error Center.