Help Center/ GeminiDB/ API Reference/ API v3/ Instances/ Obtaining Sessions of a Node
Updated on 2026-09-22 GMT+08:00

Obtaining Sessions of a Node

Function

This API is used to obtain all sessions of a node.

Constraints

This API supports GeminiDB Redis instances.

Authorization Information

Each account has permissions to call all APIs, but IAM users must have the required permissions specifically assigned.

  • If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    gaussdbfornosql:instance:listSession

    List

    instance *

    • g:ResourceTag/<tag-key>
    • g:EnterpriseProjectId

    nosql:session:list

    -

URI

GET /v3/{project_id}/redis/nodes/{node_id}/sessions

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID.

Constraints

N/A

Range

The value contains 32 characters. Only letters and digits are allowed.

Default Value

N/A

node_id

Yes

String

Definition

Node ID. To obtain the value, call the Querying Instances and Details API. If no instance is available, call the Creating an Instance API to create one.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Definition

Index offset

Constraints

N/A

Range

Greater than or equal to 0

Default Value

The default value is 0, indicating that the query starts from the latest instance node.

limit

No

Integer

Definition

Number of records per page.

Constraints

A maximum of 100 pages are supported.

Range

1 to 100

Default Value

If this parameter is not transferred, 50 sessions are displayed on each page by default.

addr_prefix

No

String

Definition

Matching character string of a user address prefix

Constraints

A complete address consists of an IP address and a port number.

Range

N/A

Default Value

If this parameter is not transferred, all address prefixes are queried by default.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token

You can obtain the token by calling the IAM API by following Obtaining a User Token Through Password Authentication.

Constraints

N/A

Range

N/A

Default Value

N/A

X-Language

No

String

Definition

Language.

Constraints

N/A

Range

  • zh-cn: Chinese
  • en-us: English

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

sessions

Array of Table 5 objects

Definition

Instance sessions.

total_count

Integer

Definition

Total sessions that meet search criteria.

Range

N/A

Table 5 InstanceSession

Parameter

Type

Description

addr

String

Definition

IP address and port number of the client.

Range

N/A

id

String

Definition

Client ID.

Range

N/A

name

String

Definition

Client name, which is specified by running CLIENT SETNAME.

Range

N/A

cmd

String

Definition

Last executed command.

Range

N/A

age

String

Definition

Setup duration of the client connection, in seconds.

Range

N/A

idle

String

Definition

Idle duration of the client connection, in seconds.

Range

N/A

db

String

Definition

ID of the currently accessed database.

Range

N/A

fd

String

Definition

File descriptor for sockets.

Range

N/A

sub

String

Definition

Number of subscribed channels (Pub/Sub).

Range

N/A

psub

String

Definition

Number of subscribed channels (Pub/Sub) in batches.

Range

N/A

multi

String

Definition

Number of commands contained in a MULTI or EXEC transaction.

Range

N/A

Example Requests

GET https://{Endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/redis/nodes/784b3fb7bac14bc490659950dd4f022fno12/sessions?offset=0&limit=20&addr_prefix=192.0.0.1:80

Example Responses

Status code: 200

Success

{ 
  "total_count" : 100, 
  "sessions" : [ { 
    "addr" : "127.0.0.1:8080", 
    "id" : "254487", 
    "name" : "cli", 
    "cmd" : "get", 
    "age" : "8888581", 
    "idle" : "8888581", 
    "db" : "0", 
    "fd" : "1311", 
    "sub" : "0", 
    "psub" : "0", 
    "multi" : "-1" 
  } ] 
}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.