Help Center/ Elastic Load Balance/ API Reference/ APIs (V3)/ Backend Server/ Querying Backend Servers in a Project
Updated on 2025-09-22 GMT+08:00

Querying Backend Servers in a Project

Function

This API is used to query the backend servers under the current project.

Constraints

This API has the following constraints:

  • Parameters marker, limit, and page_reverse are used for pagination query.

  • Parameters marker and page_reverse take effect only when they are used together with parameter limit.

Calling Method

For details, see Calling APIs.

URI

GET /v3/{project_id}/elb/members

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: Specifies the project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

Constraints: N/A

Range: The value can contain a maximum of 32 characters, including digits and lowercase letters.

Default value: N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

marker

No

String

Definition: Specifies the ID of the last record on the previous page.

Constraints:

  • This parameter must be used together with limit.

  • If the parameter is not specified, only resources on the first page are queried.

  • This parameter cannot be left blank or set to an invalid ID.

Range: N/A

Default value: N/A

limit

No

Integer

Definition: Specifies the number of records returned on each page.

Constraints: N/A

Range: 0 to 2000

Default value: 2000

page_reverse

No

Boolean

Definition: Specifies whether to use reverse query.

Constraints:

  • This parameter must be used together with limit.

  • If page_reverse is set to true and you want to query the resources on the previous page, set the value of marker to the value of previous_marker.

Range:

  • true: Query resources on the previous page.

  • false: Query resources on the next page.

Default value: false

name

No

Array of strings

Definition: Specifies the backend server name.

Multiple names can be used for query in the format of name=xxx&name=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

weight

No

Array of integers

Definition: Specifies the weight of the backend server. Requests are routed to backend servers in the same backend server group based on their weights.

If the weight is set to 0, the backend server will not accept new requests.

This parameter is invalid when lb_algorithm is set to SOURCE_IP for the backend server group that contains the backend server.

Multiple weights can be used for query in the format of weight=xxx&weight=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

admin_state_up

No

Boolean

Definition: Specifies the administrative status of the backend server.

Although this parameter can be used in the APIs for creating and updating backend servers, its actual value depends on whether ECSs exist. If ECSs exist, the value is true. Otherwise, the value is false.

Constraints: N/A

Range: true or false

Default value: N/A

subnet_cidr_id

No

Array of strings

Definition: Specifies the ID of the subnet where the backend server works. This subnet must be in the same VPC as the subnet of the load balancer associated with the backend server. Only IPv4 subnets are supported.

Multiple IDs can be used for query in the format of subnet_cidr_id=xxx&subnet_cidr_id=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

address

No

Array of strings

Definition: Specifies the IP address of the backend server. This IP address must be in the subnet specified by subnet_cidr_id, for example, 192.168.3.11.

Multiple IP addresses can be used for query in the format of address=xxx&address=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

protocol_port

No

Array of integers

Definition: Specifies the port used by the backend servers.

Multiple ports can be used for query in the format of protocol_port=xxx&protocol_port=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

id

No

Array of strings

Definition: Specifies the backend server ID.

Multiple IDs can be used for query in the format of id=xxx&id=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

operating_status

No

Array of strings

Definition: Specifies the operating status of the backend server.

Multiple statuses can be used for query in the format of operating_status=xxx&operating_status=xxx.

Constraints: N/A

Range:

  • NO_MONITOR: No health check is configured for the backend server group to which the backend server belongs.

  • INITIAL: The backend server is initializing. Health check is configured for the backend server group, but no data has been reported yet.

  • ONLINE: The backend server is running normally.

  • OFFLINE: The backend server is detected unhealthy, or the cloud server used as the backend server is stopped or does not exist.

  • UNKNOWN: The health check has not started yet, or no listener is associated with the backend server group, or the member IP address is not assigned to a cloud service instance (such as ECS, network interface, or supplementary network interface).

Default value: N/A

enterprise_project_id

No

Array of strings

Definition: Specifies the ID of the enterprise project.

Multiple values can be used for query in the format of enterprise_project_id=xxx&enterprise_project_id=xxx.

Constraints:

  • If enterprise_project_id is not specified, resources in all enterprise projects are queried by default. Fine-grained authorization is performed. The elb:members:list permission must be assigned to the user group.

  • If enterprise_project_id is specified, the value can be a specific enterprise project ID or all_granted_eps. If the value is a specific enterprise project ID, only resources in the enterprise project are queried. If the value is all_granted_eps, resources in the enterprise projects with the elb:members:list permission are queried.

Range: N/A

Default value: N/A

ip_version

No

Array of strings

Definition: Specifies the IP address version.

Multiple versions can be used for query in the format of ip_version=xxx&ip_version=xxx.

Constraints: N/A

Range: v4 or v6

Default value: N/A

pool_id

No

Array of strings

Definition: Specifies the ID of the backend server group to which the backend server belongs.

Multiple IDs can be used for query in the format of pool_id=xxx&pool_id=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

loadbalancer_id

No

Array of strings

Definition: Specifies the ID of the load balancer.

Multiple IDs can be used for query in the format of loadbalancer_id=xxx&loadbalancer_id=xxx.

Constraints: N/A

Range: N/A

Default value: N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: Specifies the token used for IAM authentication.

Constraints: N/A

Range: N/A

Default value: N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

request_id

String

Definition: Specifies the request ID.

Range: The value is automatically generated, and can contain characters including digits, lowercase letters, and hyphens (-).

page_info

PageInfo object

Definition: Specifies the pagination information.

members

Array of MemberInfo objects

Definition: Specifies the backend servers.

Table 5 PageInfo

Parameter

Type

Description

previous_marker

String

Definition: Specifies the ID of the first record in the pagination query result. If page_reverse is set to true, this parameter is used together to query resources on the previous page.

Range: N/A

next_marker

String

Definition: Specifies the ID of the last record in the pagination query result. It is usually used to query resources on the next page.

Range: N/A

current_count

Integer

Definition: Specifies the number of records returned on the current page.

Range: N/A

Table 6 MemberInfo

Parameter

Type

Description

id

String

Definition: Specifies the backend server ID.

Range: N/A

NOTE:
The value of this parameter is not the ID of the server but an ID automatically generated for the backend server that is associated with the load balancer.

availability_zone

String

Specifies the AZ where the backend server is running.

Range: N/A

name

String

Definition: Specifies the backend server name.

Range: N/A

Note: The name is not an ECS name.

project_id

String

Specifies the ID of the project where the backend server is used.

Range: N/A

pool_id

String

Definition: Specifies the ID of the backend server group to which the backend server belongs.

Range: N/A

This parameter is unsupported. Please do not use it.

admin_state_up

Boolean

Definition: Specifies the administrative status of the backend server.

Although this parameter can be used in the APIs for creating and updating backend servers, its actual value depends on whether ECSs exist. If ECSs exist, the value is true. Otherwise, the value is false.

Range: true or false

subnet_cidr_id

String

Definition: Specifies the ID of the IPv4 or IPv6 subnet where the backend server resides. neutron_subnet_id defines IPv4 subnets, and neutron_network_id defines IPv6 subnets.

You can query parameter neutron_subnet_id in the response by calling the API (GET https://{VPC_Endpoint}/v1/{project_id}/subnets) to get the IPv4 subnet ID.

You can query parameter neutron_network_id in the response by calling the API (GET https://{VPC_Endpoint}/v1/{project_id}/subnets) to get the IPv6 subnet ID.

Range: N/A

protocol_port

Integer

Definition: Specifies the port used by the backend server to receive requests.

Range: N/A

weight

Integer

Definition: Specifies the weight of the backend server. Requests are routed based on the load balancing algorithm configured for the backend server group and weights of backend servers.

The larger the weight is, the higher proportion of requests the backend server receives. If the weight is set to 0, the backend server will not accept new requests.

Range: 0 to 100

address

String

Definition: Specifies the IP address bound to the backend server.

Range:

  • If subnet_cidr_id is left blank, IP as backend servers will be added. In this case, the IP address must be an IPv4 address.

  • If subnet_cidr_id is not left blank, ECSs, BMSs, or supplementary network interfaces will be added as backend servers. It must be in the subnet specified by subnet_cidr_id.

ip_version

String

Definition: Specifies the IP address version supported by the backend server. The version depends on the value of address returned by the system.

Range: v4 or v6

device_owner

String

Definition: Specifies whether the backend server is associated with an ECS.

Range:

  • If this parameter is left blank, the backend server is not associated with an ECS.

  • If the value is compute:{az_name}, the backend server is associated with an ECS. {az_name} indicates the AZ where the ECS resides.

  • If the value is compute:subeni, supplementary network interfaces are added as backend servers.

This parameter is unsupported. Please do not use it.

device_id

String

Definition: Specifies the ID of the ECS with which the backend server is associated. If this parameter is left blank, the backend server is not associated with an ECS.

Range: N/A

This parameter is unsupported. Please do not use it.

operating_status

String

Definition: Specifies the operating status of the backend server if listener_id under status is not specified.

Range:

  • NO_MONITOR: No health check is configured for the backend server group to which the backend server belongs.

  • INITIAL: The backend server is initializing. Health check is configured for the backend server group, but no data has been reported yet.

  • ONLINE: The backend server is running normally.

  • OFFLINE: The backend server is detected unhealthy, or the cloud server used as the backend server is stopped or does not exist.

  • UNKNOWN: The health check has not started yet, or no listener is associated with the backend server group, or the member IP address is not assigned to a cloud service instance (such as ECS, network interface, or supplementary network interface).

status

Array of MemberStatus objects

Definition: Specifies the health status of the backend server if listener_id under status is specified. If listener_id under status is not specified, operating_status of member takes precedence.

loadbalancer_id

String

Definition: Specifies the ID of the load balancer.

This parameter is unsupported. Please do not use it.

loadbalancers

Array of ResourceID objects

Definition: Specifies the IDs of the load balancers associated with the backend server.

This parameter is unsupported. Please do not use it.

created_at

String

Definition: Specifies the creation time. The value must be a UTC time in the format of yyyy-MM-dd'T'HH:mm:ss'Z'.

Range: N/A

Note: This parameter will not be returned for resources associated with existing dedicated load balancers and for resources associated with existing and new shared load balancers.

updated_at

String

Definition: Specifies the update time. The value must be a UTC time in the format of yyyy-MM-dd'T'HH:mm:ss'Z'.

Range: N/A

Note: This parameter will not be returned for resources associated with existing dedicated load balancers and for resources associated with existing and new shared load balancers.

member_type

String

Definition: Specifies the type of the backend server.

Range:

  • ip: IP as backend servers

  • instance: ECSs used as backend servers

instance_id

String

Definition: Specifies the ID of the instance associated with the backend server. If this parameter is left blank, the backend server is not a real device. It may be an IP address.

Range: N/A

reason

MemberHealthCheckFailedReason object

Definition: Specifies why health check fails.

Table 7 MemberStatus

Parameter

Type

Description

listener_id

String

Definition: Specifies the listener ID.

Range: N/A

operating_status

String

Definition: Specifies the operating status of the backend server.

Range:

  • ONLINE: The backend server is running normally.

  • NO_MONITOR: No health check is configured for the backend server group to which the backend server belongs.

  • OFFLINE: The ECS used as the backend server is stopped or does not exist.

reason

MemberHealthCheckFailedReason object

Definition: Specifies why the health check fails.

created_at

String

Definition: Specifies the creation time. The value must be a UTC time in the format of yyyy-MM-dd'T'HH:mm:ss'Z'.

Range: N/A

updated_at

String

Definition: Specifies the update time. The value must be a UTC time in the format of yyyy-MM-dd'T'HH:mm:ss'Z'.

Range: N/A

Table 8 ResourceID

Parameter

Type

Description

id

String

Definition: Specifies the resource ID.

Table 9 MemberHealthCheckFailedReason

Parameter

Type

Description

reason_code

String

Definition: Specifies the code of the health check failures.

Range:

  • CONNECT_TIMEOUT: The connection with the backend server times out during a health check.

  • CONNECT_REFUSED: The load balancer rejects connections with the backend server during a health check.

  • CONNECT_FAILED: The load balancer fails to establish connections with the backend server during a health check.

  • CONNECT_INTERRUPT: The load balancer is disconnected from the backend server during a health check.

  • SSL_HANDSHAKE_ERROR: The SSL handshakes with the backend server fail during a health check.

  • RECV_RESPONSE_FAILED: The load balancer fails to receive responses from the backend server during a health check.

  • RECV_RESPONSE_TIMEOUT: The load balancer does not receive responses from the backend server within the timeout duration during a health check.

  • SEND_REQUEST_FAILED: The load balancer fails to send a health check request to the backend server during a health check.

  • SEND_REQUEST_TIMEOUT: The load balancer fails to send a health check request to the backend server within the timeout duration.

  • RESPONSE_FORMAT_ERROR: The load balancer receives invalid responses from the backend server during a health check.

  • RESPONSE_MISMATCH: The response code received from the backend server is different from the preset code.

expected_response

String

Definition: Specifies the expected HTTP status code. This parameter will take effect only when type is set to HTTP, HTTPS, or GRPC. The status code cannot be null if reason_code is RESPONSE_MISMATCH.

Range:

  • A specific status code. If type is set to GRPC, the status code ranges from 0 to 99. If type is set to other values, the status code ranges from 200 to 599. For example, the status code can be 0 or 200.

  • A list of status codes that are separated with commas (,), for example, 200,202 or 0,1. A maximum of five status codes are supported.

  • A status code range. Different ranges are separated with commas (,), for example, 200-204,300-399 or 0-5,10-12,20-30. A maximum of five ranges are supported.

healthcheck_response

String

Definition: Specifies the returned HTTP status code in the response. This parameter will take effect only when type is set to HTTP, HTTPS, or GRPC. The status code cannot be null if reason_code is RESPONSE_MISMATCH.

Range:

  • A specific status code. If type is set to GRPC, the status code ranges from 0 to 99. If type is set to other values, the status code ranges from 200 to 599. For example, the status code can be 0 or 200.

Example Requests

Querying all backend servers under the current project

GET https://{ELB_Endpoint}/v3/7a9941d34fc1497d8d0797429ecfd354/elb/members

Example Responses

Status code: 200

Successful request.

{
  "request_id" : "9bd54b2c-b6c6-4635-9495-dd89bdd917ad",
  "members" : [ {
    "name" : "member-1",
    "weight" : 1,
    "admin_state_up" : true,
    "project_id" : "86f9bb15ce80442680229fcd4dc96582",
    "address" : "192.168.0.157",
    "protocol_port" : 80,
    "id" : "f5e20309-c79c-470c-b59c-3c8378792897",
    "operating_status" : "ONLINE",
    "status" : [ {
      "listener_id" : "0663b12d-4a8f-4ee1-8ba2-dd09f2c92ef7",
      "operating_status" : "ONLINE"
    }, {
      "listener_id" : "19ac6a54-336f-44ce-9679-50c4f56e9407",
      "operating_status" : "ONLINE"
    } ],
    "instance_id" : "39b7d471-fbb4-4e6d-ac81-635b4415a27f",
    "device_id" : "39b7d471-fbb4-4e6d-ac81-635b4415a27f",
    "device_owner" : "compute:az1",
    "member_type" : "instance",
    "created_at" : "2023-05-04T06:55:33Z",
    "updated_at" : "2023-05-08T01:34:02Z",
    "loadbalancer_id" : "9eafbe79-4d48-46f6-95e6-0bc3da57b96d",
    "loadbalancers" : [ {
      "id" : "9eafbe79-4d48-46f6-95e6-0bc3da57b96d"
    } ],
    "pool_id" : "46cd9381-3d99-4e32-b799-efaf5c274586",
    "ip_version" : "v4",
    "subnet_cidr_id" : "1aee2ab8-f238-4c26-8659-2a7a0c201d0a"
  }, {
    "name" : "member-2",
    "admin_state_up" : true,
    "project_id" : "86f9bb15ce80442680229fcd4dc96582",
    "address" : "192.168.0.157",
    "protocol_port" : 80,
    "id" : "f834d6c6-b376-4031-931e-57cb36bca4a8",
    "operating_status" : "OFFLINE",
    "status" : [ ],
    "instance_id" : "39b7d471-fbb4-4e6d-ac81-635b4415a27f",
    "device_id" : "39b7d471-fbb4-4e6d-ac81-635b4415a27f",
    "device_owner" : "compute:az1",
    "member_type" : "instance",
    "created_at" : "2023-05-04T12:46:55Z",
    "updated_at" : "2023-05-05T03:56:40Z",
    "loadbalancers" : [ ],
    "pool_id" : "d17d07db-5bab-4a15-aa6f-8561af133ca7",
    "ip_version" : "v4",
    "subnet_cidr_id" : "1aee2ab8-f238-4c26-8659-2a7a0c201d0a"
  } ],
  "page_info" : {
    "next_marker" : "fb1ce58f-2525-4bd9-9606-10851533bd22",
    "previous_marker" : "fb19f821-5d5f-4d72-b11c-503e874d3915",
    "current_count" : 2
  }
}

SDK Sample Code

The SDK sample code is as follows.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.elb.v3.region.ElbRegion;
import com.huaweicloud.sdk.elb.v3.*;
import com.huaweicloud.sdk.elb.v3.model.*;


public class ListAllMembersSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        ElbClient client = ElbClient.newBuilder()
                .withCredential(auth)
                .withRegion(ElbRegion.valueOf("<YOUR REGION>"))
                .build();
        ListAllMembersRequest request = new ListAllMembersRequest();
        try {
            ListAllMembersResponse response = client.listAllMembers(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkelb.v3.region.elb_region import ElbRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkelb.v3 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = ElbClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(ElbRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListAllMembersRequest()
        response = client.list_all_members(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    elb "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/elb/v3/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := elb.NewElbClient(
        elb.ElbClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListAllMembersRequest{}
	response, err := client.ListAllMembers(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

Successful request.

Error Codes

See Error Codes.