DescribeGameSessions - Amazon GameLift

DescribeGameSessions

Retrieves a set of one or more game sessions in a specific fleet location. You can optionally filter the results by current game session status.

This operation can be used in the following ways:

  • To retrieve all game sessions that are currently running on all locations in a fleet, provide a fleet or alias ID, with an optional status filter. This approach returns all game sessions in the fleet's home Region and all remote locations.

  • To retrieve all game sessions that are currently running on a specific fleet location, provide a fleet or alias ID and a location name, with optional status filter. The location can be the fleet's home Region or any remote location.

  • To retrieve a specific game session, provide the game session ID. This approach looks for the game session ID in all fleets that reside in the AWS Region defined in the request.

Use the pagination parameters to retrieve results as a set of sequential pages.

If successful, a GameSession object is returned for each game session that matches the request.

This operation is not designed to be continually called to track game session status. This practice can cause you to exceed your API limit, which results in errors. Instead, you must configure an Amazon Simple Notification Service (SNS) topic to receive notifications from FlexMatch or queues. Continuously polling with DescribeGameSessions should only be used for games in development with low game session usage.

Available in Amazon GameLift Local.

Learn more

Find a game session

All APIs by task

Request Syntax

{ "AliasId": "string", "FleetId": "string", "GameSessionId": "string", "Limit": number, "Location": "string", "NextToken": "string", "StatusFilter": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

Note

In the following list, the required parameters are described first.

AliasId

A unique identifier for the alias associated with the fleet to retrieve game sessions for. You can use either the alias ID or ARN value.

Type: String

Pattern: ^alias-\S+|^arn:.*:alias\/alias-\S+

Required: No

FleetId

A unique identifier for the fleet to retrieve game sessions for. You can use either the fleet ID or ARN value.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 512.

Pattern: ^[a-z]*fleet-[a-zA-Z0-9\-]+$|^arn:.*:[a-z]*fleet\/[a-z]*fleet-[a-zA-Z0-9\-]+$

Required: No

GameSessionId

A unique identifier for the game session to retrieve.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 512.

Pattern: [a-zA-Z0-9:/-]+

Required: No

Limit

The maximum number of results to return. Use this parameter with NextToken to get results as a set of sequential pages.

Type: Integer

Valid Range: Minimum value of 1.

Required: No

Location

A fleet location to get game sessions for. You can specify a fleet's home Region or a remote location. Use the AWS Region code format, such as us-west-2.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 64.

Pattern: ^[A-Za-z0-9\-]+

Required: No

NextToken

A token that indicates the start of the next sequential page of results. Use the token that is returned with a previous call to this operation. To start at the beginning of the result set, do not specify a value.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

StatusFilter

Game session status to filter results on. You can filter on the following states: ACTIVE, TERMINATED, ACTIVATING, and TERMINATING. The last two are transitory and used for only very brief periods of time.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

Response Syntax

{ "GameSessions": [ { "CreationTime": number, "CreatorId": "string", "CurrentPlayerSessionCount": number, "DnsName": "string", "FleetArn": "string", "FleetId": "string", "GameProperties": [ { "Key": "string", "Value": "string" } ], "GameSessionData": "string", "GameSessionId": "string", "IpAddress": "string", "Location": "string", "MatchmakerData": "string", "MaximumPlayerSessionCount": number, "Name": "string", "PlayerSessionCreationPolicy": "string", "Port": number, "Status": "string", "StatusReason": "string", "TerminationTime": number } ], "NextToken": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

GameSessions

A collection of properties for each game session that matches the request.

Type: Array of GameSession objects

NextToken

A token that indicates where to resume retrieving results on the next call to this operation. If no token is returned, these results represent the end of the list.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServiceException

The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.

HTTP Status Code: 500

InvalidRequestException

One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.

HTTP Status Code: 400

NotFoundException

The requested resources was not found. The resource was either not created yet or deleted.

HTTP Status Code: 400

TerminalRoutingStrategyException

The service is unable to resolve the routing for a particular alias because it has a terminal RoutingStrategy associated with it. The message returned in this exception is the message defined in the routing strategy itself. Such requests should only be retried if the routing strategy for the specified alias is modified.

HTTP Status Code: 400

UnauthorizedException

The client failed authentication. Clients should not retry such requests.

HTTP Status Code: 400

UnsupportedRegionException

The requested operation is not supported in the Region specified.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: