Documentation

GetPlayersInSegment

Allows for paging through all players in a given segment. This API creates a snapshot of all player profiles that match the segment definition at the time of its creation and lives through the Total Seconds to Live, refreshing its life span on each subsequent use of the Continuation Token. Profiles that change during the course of paging will not be reflected in the results. AB Test segments are currently not supported by this operation.

Request Details

Initial request must contain at least a Segment ID. Subsequent requests must contain the Segment ID as well as the Continuation Token. Failure to send the Continuation Token will result in a new player segment list being generated. Each time the Continuation Token is passed in the length of the Total Seconds to Live is refreshed. If too much time passes between requests to the point that a subsequent request is past the Total Seconds to Live an error will be returned and paging will be terminated. This API is resource intensive and should not be used in scenarios which might generate high request volumes. Only one request to this API at a time should be made per title. Concurrent requests to the API may be rejected with the APIConcurrentRequestLimitExceeded error.

GetPlayersInSegmentRequest
Request Properties
ContinuationToken String

Continuation token if retrieving subsequent pages of results.

MaxBatchSize uint32

Maximum number of profiles to load. Default is 1,000. Maximum is 10,000.

SecondsToLive uint32

Number of seconds to keep the continuation token active. After token expiration it is not possible to continue paging results. Default is 300 (5 minutes). Maximum is 1,800 (30 minutes).

SegmentId (required) String

Unique identifier for this segment.

POST https://{{TitleID}}.playfabapi.com/Admin/GetPlayersInSegment
    Content-Type: application/json
    X-SecretKey: <developer_secret_key>
{
  "SegmentId": "1337AA00",
  "SecondsToLive": 5,
  "MaxBatchSize": 500
}
        

Response Details

GetPlayersInSegmentResult
Result Properties
ContinuationToken String

Continuation token to use to retrieve subsequent pages of results. If token returns null there are no more results.

PlayerProfiles List<PlayerProfile>

Array of player profiles in this segment.

ProfilesInSegment (required) int32

Count of profiles matching this segment.

Sample Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
  "code": 200,
  "status": "OK",
  "data": {
    "ProfilesInSegment": 15,
    "ContinuationToken": "asd981if0aiojiud",
    "PlayerProfiles": []
  }
}

Authentication

SecretKey

Possible Error Codes

Name Code
ExpiredContinuationToken 1241
InvalidContinuationToken 1240
InvalidSearchTerm 1245
SegmentNotFound 1220