Updated on 2026-09-22 GMT+08:00

Obtaining Instance Sessions

Function

This API is used to obtain instance sessions.

Constraints

This API supports the following instance:

  • GeminiDB Redis

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}/instances/{instance_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

instance_id

Yes

String

Definition

Instance 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

node_id

No

String

Definition

Node ID. To obtain the value, call the Querying Instances and Details API.

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

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

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

node_sessions

Array of objects in Table 5

Definition

Node sessions

Table 5 ListNodeSessionsResult

Parameter

Type

Description

node_id

String

Definition

Node ID

Range

N/A

total_count

Integer

Definition

Total number of sessions

Range

N/A

sessions

Array of objects in Table 6

Definition

Node session details

Table 6 sessions

Parameter

Type

Description

id

String

Definition

Session ID

Range

N/A

name

String

Definition

Connection name

Range

N/A

cmd

String

Definition

Last executed command

Range

N/A

age

String

Definition

Connection duration (seconds)

Range

N/A

idle

String

Definition

Idle duration (seconds)

Range

N/A

db

String

Definition

ID of a database that is being used by a client

Range

N/A

addr

String

Definition

IP address and port of a client

Range

N/A

fd

String

Definition

File descriptor for sockets

Range

N/A

sub

String

Definition

Number of subscribed channels

Range

N/A

psub

String

Definition

Number of subscribed modes

Range

N/A

multi

String

Definition

Number of commands executed in a transaction

Range

N/A

Example Requests

  • Querying sessions of all nodes on an instance
    GET https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances/e73893ef73754465a8bd2e0857bbf13ein12/sessions
  • Querying sessions of a specified node on an instance
    GET https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances/e73893ef73754465a8bd2e0857bbf13ein12/sessions?node_id=9d3288bbbb81448e8a99ff41a5717281no12

Example Responses

Status code: 200

Success

{ 
  "node_sessions" : [ { 
    "node_id" : "8436a91546294036b75931e879882200in06", 
    "total_count" : 1, 
    "sessions" : [ { 
      "addr" : "127.0.0.1:8080", 
      "id" : "54487", 
      "name" : "cli", 
      "cmd" : "get", 
      "age" : "8888581", 
      "idle" : "8888581", 
      "db" : "0", 
      "fd" : "1311", 
      "sub" : "0", 
      "psub" : "0", 
      "multi" : "-1" 
    } ] 
  }, { 
    "node_id" : "8123sa46294daw13def423fw79882200in06", 
    "total_count" : 1, 
    "sessions" : [ { 
      "addr" : "127.0.0.1:8080", 
      "id" : "54488", 
      "name" : "cli", 
      "cmd" : "get", 
      "age" : "3124124", 
      "idle" : "4414141", 
      "db" : "0", 
      "fd" : "1312", 
      "sub" : "0", 
      "psub" : "0", 
      "multi" : "-1" 
    } ] 
  } ] 
}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.