0

List nodes

by
Published Oct 17, 2025

Returns a paginated list of NodeBalancer nodes associated with this Config. These are the backends that will be sent traffic for this port. > --- - __CLI__. ``` linode-cli nodebalancers nodes-list 12345 4567 ``` [Learn more...](https://techdocs.akamai.com/cloud-computing/docs/getting-started-with-the-linode-cli) - __OAuth scopes__. ``` nodebalancers:read_only ``` [Learn more...](https://techdocs.akamai.com/linode-api/reference/get-started#oauth)

Script linode Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Linode = {
3
  token: string;
4
};
5
/**
6
 * List nodes
7
 * Returns a paginated list of NodeBalancer nodes associated with this Config. These are the backends that will be sent traffic for this port.
8

9

10
>
11

12
---
13

14

15
- __CLI__.
16

17
    ```
18
    linode-cli nodebalancers nodes-list 12345 4567
19
    ```
20

21
    [Learn more...](https://techdocs.akamai.com/cloud-computing/docs/getting-started-with-the-linode-cli)
22

23
- __OAuth scopes__.
24

25
    ```
26
    nodebalancers:read_only
27
    ```
28

29
    [Learn more...](https://techdocs.akamai.com/linode-api/reference/get-started#oauth)
30
 */
31
export async function main(
32
  auth: Linode,
33
  apiVersion: "v4" | "v4beta",
34
  nodeBalancerId: string,
35
  configId: string,
36
  page: string | undefined,
37
  page_size: string | undefined,
38
) {
39
  const url = new URL(
40
    `https://api.linode.com/${apiVersion}/nodebalancers/${nodeBalancerId}/configs/${configId}/nodes`,
41
  );
42
  for (const [k, v] of [
43
    ["page", page],
44
    ["page_size", page_size],
45
  ]) {
46
    if (v !== undefined && v !== "" && k !== undefined) {
47
      url.searchParams.append(k, v);
48
    }
49
  }
50
  const response = await fetch(url, {
51
    method: "GET",
52
    headers: {
53
      Authorization: "Bearer " + auth.token,
54
    },
55
    body: undefined,
56
  });
57
  if (!response.ok) {
58
    const text = await response.text();
59
    throw new Error(`${response.status} ${text}`);
60
  }
61
  return await response.json();
62
}
63