SearchGameServerSessions

Last updated: 2021-05-11 10:58:56

1. API Description

Domain name for API request: gse.tencentcloudapi.com.

This API is used to search in the list of game server sessions.

A maximum of 1000 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common parameter. The value used for this API: SearchGameServerSessions.
Version Yes String Common parameter. The value used for this API: 2019-11-12.
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
AliasId No String Alias ID
FleetId No String Fleet ID
Limit No Integer Maximum number of entries in a single query
NextToken No String Pagination offset, which is used for querying the next page. It should contain 1 to 1024 ASCII characters.
FilterExpression No String Search filter expression. Valid values:
gameServerSessionName: game session name in String type
gameServerSessionId: game session ID in String type
maximumSessions: maximum number of player sessions in Number type
creationTimeMillis: creation time in milliseconds in Number type
playerSessionCount: current number of player sessions in Number type
hasAvailablePlayerSessions: whether there is available player session in String type. Valid values: true, false
gameServerSessionProperties: game session attributes in String type

Expressions in String type support = and <> for judgment
Expressions in Number type support =, <>, >, >=, <, and <= for judgment

Example:
If FilterExpression takes the value:
playerSessionCount>=2 AND hasAvailablePlayerSessions=true"
It means searching for game sessions that have at least two players and have player sessions available.
If FilterExpression takes the value:
gameServerSessionProperties.K1 = 'V1' AND gameServerSessionProperties.K2 = 'V2' OR gameServerSessionProperties.K3 = 'V3'

it means
searching for game sessions that meets the following game server session attributes
{
"GameProperties":[
{
"Key":"K1",
"Value":"V1"
},
{
"Key":"K2",
"Value":"V2"
},
{
"Key":"K3",
"Value":"V3"
}
]
}
SortExpression No String Sorting keyword
Valid values:
gameServerSessionName: game session name in String type
gameServerSessionId: game session ID in String type
maximumSessions: maximum number of player sessions in Number type
creationTimeMillis: creation time in milliseconds in Number type
playerSessionCount: current number of player sessions in Number type

3. Output Parameters

Parameter Name Type Description
GameServerSessions Array of GameServerSession Game server session list
Note: this field may return null, indicating that no valid values can be obtained.
NextToken String Pagination offset, which is used for querying the next page. It should contain 1 to 1024 ASCII characters.
Note: this field may return null, indicating that no valid value is obtained.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Searching for a game session by creationTimeMillis

This example shows you how to search for a game session by the creation time.
creationTimeMillis = 1575518668000, which is the game session creation time in milliseconds in UTC time.
Filter expression:
FilterExpression: creationTimeMillis=1575518668000

Input Example

https://gse.tencentcloudapi.com/?Action=SearchGameServerSessions
&FleetId=fleet-qp3g3caa-b1adh8hq
&Limit=1
&NextToken=nextToken-4hpp445-niuu789
&FilterExpression=creationTimeMillis%3d1575518668000
&SortExpression=creationTimeMillis+ASC
&<Common request parameters>

Output Example

{
  "Response": {
    "GameServerSessions": [
      {
        "CreationTime": "2019-12-05T12:04:28Z",
        "CreatorId": "c2",
        "CurrentPlayerSessionCount": "0",
        "DnsName": "",
        "FleetId": "fleet-00test-a5testzz",
        "GameProperties": [
          {
            "Key": "Key-2aa06131-7d54-11ea-b3e7-3464a91513fe",
            "Value": "Value-2aa06132-7d54-11ea-8199-3464a91513fe"
          },
          {
            "Key": "Key-2aa06133-7d54-11ea-aaac-3464a91513fe",
            "Value": "Value-2aa06134-7d54-11ea-8fa2-3464a91513fe"
          },
          {
            "Key": "Key-2aa06135-7d54-11ea-a9c1-3464a91513fe",
            "Value": "Value-2aa06136-7d54-11ea-b30b-3464a91513fe"
          }
        ],
        "GameServerSessionData": "",
        "GameServerSessionId": "qcs::gse:ap-shanghai:uin/1112222:gameserversession/fleet-qp3ga-p70zzzz/gssess-aaaa-ilqsssu/PlacementId-124ddda-4e28-1111-222b-111222",
        "AvailabilityStatus": "ENABLE",
        "InstanceType": "S5.SMALL2",
        "IpAddress": "0000.0.0.0",
        "MatchmakerData": "",
        "MaximumPlayerSessionCount": "10",
        "Name": "game-session-name",
        "PlayerSessionCreationPolicy": "ACCEPT_ALL",
        "Port": "8000",
        "Status": "ACTIVE",
        "StatusReason": "",
        "TerminationTime": "2019-12-05T04:04:28Z",
        "CurrentCustomCount": 0,
        "MaxCustomCount": 10,
        "Weight": 5
      }
    ],
    "NextToken": "",
    "RequestId": "0fffff4-oooo-43333d-9222-testaaa"
  }
}

Example2 Searching for a game session by GameProperties

This example shows you how to query the list of game sessions whose GameProperties includes a key-value pair of Key-2aa06135-7d54-11ea-a9c1-3464a91513 and Value-2aa06136-7d54-11ea-b30b-3464a91513fe.
Filter expression:
FilterExpression: gameServerSessionProperties.Key-2aa06135-7d54-11ea-a9c1-3464a91513fe=Value-2aa06136-7d54-11ea-b30b-3464a91513fe

Input Example

https://gse.tencentcloudapi.com/?Action=SearchGameServerSessions
&FleetId=fleet-qp3g3caa-b1adh8hq
&Limit=1
&NextToken=nextToken-4hpp445-niuu789
&FilterExpression=gameServerSessionProperties.Key-2aa06135-7d54-11ea-a9c1-3464a91513fe%3dValue-2aa06136-7d54-11ea-b30b-3464a91513fe
&SortExpression=creationTimeMillis+ASC
&<Common request parameters>

Output Example

{
  "Response": {
    "GameServerSessions": [
      {
        "AvailabilityStatus": "Unknown",
        "CreationTime": "2020-04-13T06:58:27Z",
        "CreatorId": "",
        "CurrentCustomCount": 0,
        "CurrentPlayerSessionCount": 0,
        "DnsName": "",
        "FleetId": "fleet-qp3g3caa-b1adh8hq",
        "GameProperties": [
          {
            "Key": "Key-2aa06131-7d54-11ea-b3e7-3464a91513fe",
            "Value": "Value-2aa06132-7d54-11ea-8199-3464a91513fe"
          },
          {
            "Key": "Key-2aa06133-7d54-11ea-aaac-3464a91513fe",
            "Value": "Value-2aa06134-7d54-11ea-8fa2-3464a91513fe"
          },
          {
            "Key": "Key-2aa06135-7d54-11ea-a9c1-3464a91513fe",
            "Value": "Value-2aa06136-7d54-11ea-b30b-3464a91513fe"
          }
        ],
        "GameServerSessionData": "",
        "GameServerSessionId": "qcs::gse:ap-shanghai:uin/0:gameserversession/fleet-qp3g3caa-b1adh8hq/gssess-k17ia36c-omi2numy",
        "InstanceType": "S5.SMALL2",
        "IpAddress": "200.0.0.1",
        "MatchmakerData": "",
        "MaxCustomCount": 0,
        "MaximumPlayerSessionCount": 78,
        "Name": "GameServerSessionName-2aa06130-7d54-11ea-9263-3464a91513fe",
        "PlayerSessionCreationPolicy": "ACCEPT_ALL",
        "Port": 59920,
        "Status": "ACTIVE",
        "StatusReason": "",
        "TerminationTime": null,
        "Weight": 0
      }
    ],
    "NextToken": "ntoken-bldnitiu-4cnjt4c0",
    "RequestId": "s1587465032390722054"
  }
}

Example3 Searching for a game session using complex expression

Filter expression:
FilterExpression:
(maximumSessions>=10 OR playerSessionCount=0) OR NOT (creationTimeMillis>1575518668000) OR (maximumSessions>=10 AND hasAvailablePlayerSessions=true)

Input Example

https://gse.tencentcloudapi.com/?Action=SearchGameServerSessions
&FleetId=fleet-qp3g3caa-b1adh8hq
&Limit=1
&NextToken=nextToken-4hpp445-niuu789
&FilterExpression=(maximumSessions%3e%3d10+OR+playerSessionCount%3d0)+OR+NOT+(creationTimeMillis%3e1575518668000)+OR+(maximumSessions%3e%3d10+AND+hasAvailablePlayerSessions%3dtrue)
&SortExpression=creationTimeMillis+ASC
&<Common request parameters>

Output Example

{
  "Response": {
    "GameServerSessions": [
      {
        "AvailabilityStatus": "Unknown",
        "CreationTime": "2020-04-13T06:58:07Z",
        "CreatorId": "",
        "MaxCustomCount": 0,
        "CurrentCustomCount": 0,
        "CurrentPlayerSessionCount": 0,
        "DnsName": "",
        "FleetId": "fleet-qp3g3caa-b1adh8hq",
        "GameProperties": [
          {
            "Key": "Key-1ea66e9e-7d54-11ea-a4aa-3464a91513fe",
            "Value": "Value-1ea66e9f-7d54-11ea-a71e-3464a91513fe"
          },
          {
            "Key": "Key-1ea66ea0-7d54-11ea-9afd-3464a91513fe",
            "Value": "Value-1ea66ea1-7d54-11ea-a5f2-3464a91513fe"
          },
          {
            "Key": "Key-1ea66ea2-7d54-11ea-b184-3464a91513fe",
            "Value": "Value-1ea66ea3-7d54-11ea-b355-3464a91513fe"
          }
        ],
        "GameServerSessionData": "",
        "GameServerSessionId": "qcs::gse:ap-shanghai:uin/0:gameserversession/fleet-qp3g3caa-b1adh8hq/gssess-k17ia36c-2hs38yc0",
        "InstanceType": "S5.SMALL2",
        "IpAddress": "200.0.0.2",
        "MatchmakerData": "",
        "MaximumPlayerSessionCount": 181,
        "Name": "GameServerSessionName-1ea66e9d-7d54-11ea-b041-3464a91513fe",
        "PlayerSessionCreationPolicy": "ACCEPT_ALL",
        "Port": 59106,
        "Status": "ACTIVE",
        "StatusReason": "",
        "TerminationTime": null,
        "Weight": 0
      },
      {
        "AvailabilityStatus": "Unknown",
        "CreationTime": "2020-04-13T07:49:16Z",
        "CreatorId": "",
        "CurrentCustomCount": 0,
        "CurrentPlayerSessionCount": 0,
        "DnsName": "",
        "FleetId": "fleet-qp3g3caa-b1adh8hq",
        "GameProperties": [],
        "GameServerSessionData": "",
        "GameServerSessionId": "qcs::gse:ap-shanghai:uin/0:gameserversession/fleet-qp3g3caa-b1adh8hq/gssess-k17ia36c-oik1x49i",
        "InstanceType": "S5.SMALL2",
        "IpAddress": "200.0.0.1",
        "MatchmakerData": "",
        "MaxCustomCount": 0,
        "MaximumPlayerSessionCount": 200,
        "Name": "GameServerSessionName-45bd031c-7d5b-11ea-acf8-52540024df83",
        "PlayerSessionCreationPolicy": "ACCEPT_ALL",
        "Port": 59110,
        "Status": "ACTIVE",
        "StatusReason": "",
        "TerminationTime": null,
        "Weight": 0
      }
    ],
    "NextToken": "ntoken-bldnitiu-4cnjt4c0",
    "RequestId": "s1587466067806554523"
  }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation Operation failed.
InternalError An internal error occurred.
InvalidParameter Incorrect parameter.
InvalidParameterValue Incorrect parameter value.
UnauthorizedOperation The operation is unauthorized.
UnauthorizedOperation.ServiceNotOpened The service is not activated.
UnsupportedOperation Unsupported operation.