All Products
Search
Document Center

Function Compute:ListSessions

最終更新日:Dec 19, 2025

Lists sessions in the Active and/or Expired state(s) under the specified function. Supports filtering by qualifier, status, and session ID, as well as paginated queries. Returns basic session attributes for batch viewing of session distribution and status, helping with operations monitoring and integration with external systems, and enhancing session visibility and management.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
fc:ListSessionslist
*All Resources
*
    none
none

Request syntax

GET /2023-03-30/functions/{functionName}/sessions HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
functionNamestringNo

The function name.

my-func
qualifierstringNo

The function alias or version.

aliasName1
limitintegerNo

The number of sessions to be returned. If this parameter is not specified, 20 sessions are returned by default.

10
nextTokenstringNo

The token for the next page.

MTIzNCNhYmM=
sessionStatusstringNo

The session status to filter. By default, information for all sessions in the Active and Expired states is returned. You can specify Active to retrieve only active sessions, or Expired to retrieve only expired sessions.

Active
sessionIdstringNo

The SessionId value to filter. If specified, all session information associated with this session ID in Active or Expired states is returned.

test-session-id-1

Response parameters

ParameterTypeDescriptionExample
ListSessionsOutput

The list of returned session information.

Examples

Sample success responses

JSONformat

{
  "nextToken": "MTIzNCNhYmM=",
  "sessions": [
    {
      "sessionId": "81f70ae156904eb9b7d43e12f511fe58",
      "functionName": "functionName1",
      "sessionAffinityType": "HEADER_FIELD",
      "sessionTTLInSeconds": 21600,
      "sessionIdleTimeoutInSeconds": 1800,
      "createdTime": "2025-04-01T08:15:27Z",
      "lastModifiedTime": "2025-04-01T18:15:27Z",
      "sessionStatus": "Active",
      "containerId": "c-68999e02-16a1955c-d2a03d1ccs",
      "qualifier": "AliasName1",
      "nasConfig": {
        "groupId": 100,
        "mountPoints": [
          {
            "enableTLS": true,
            "mountDir": "/home/test",
            "serverAddr": "***-uni85.cn-hangzhou.nas.com:/"
          }
        ],
        "userId": 100
      }
    }
  ]
}

Error codes

For a list of error codes, visit the Service error codes.