Get plays for a given user
GET/api/v2/plays
Retrieves detailed play-by-play analytics data for puzzles in a series or specific puzzle IDs for a given user. Each play includes common fields (userId, startTime, endTime, etc.) along with puzzle type specific state details that contain relevant statistics and progress information.
Puzzle Type Support:
- Grid Games (Crossword, Codeword, KrissKross, Sudoku): Box completion statistics
- Quiz Games: Question attempt statistics
- Word Search & Word Flower: Word finding progress
- Jigsaw: Piece placement progress
Time Range Filtering:
- Use
from(inclusive) and/orto(inclusive) to filter plays by start time (startedAt, ISO 8601 format). - If neither is provided, all plays are considered.
- If only
fromis provided, plays from that time onwards are considered. - If only
tois provided, plays up to that time are considered. - If both are provided, plays between
fromandto(inclusive) are considered.
Pagination and Ordering:
Results are paginated with the limit and offset parameters and are ordered by startedAt in descending order (most recent starts first).
Parameter limit (integer) specifies the maximum number of plays to return per request and offset denotes the number of plays to skip (in the descending order of startedAt) before starting to return results. To retrieve all the plays using this endpoint:
- Call the endpoint with
offset=0. - Process the returned plays.
- If the
hasMorefield is set totrue, request the next page by increasingoffsetbylimit. - Repeat step 3 until a response returns
hasMorefield as false, indicating there are no more results.
Use Cases:
- Streak Computation: Use
startedAtandupdatedAtcombined withplayProgressfields to compute user streaks. For example, calculate consecutive days a user has completed puzzles by checking ifstartedAtandupdatedAtfall on the puzzle's publish date and theplayProgress.playStateindicates completion. - Puzzle Details: To get detailed information about the puzzles corresponding to the returned play IDs, use the separate Puzzles API endpoint (
/api/v2/puzzles) with thepuzzleIdsparameter containing the puzzle IDs from the plays response.
Examples:
Single Puzzle Play for given User:
curl -L 'http://localhost:8080/pmm-dev/api/v2/plays?series=demo-api&puzzleIds=123ba400&userId=9f7439e7-ecf1-4c03-ba90-91273f149231' \
-H 'Accept: application/json'
Multiple Puzzle Plays (Comma-separated puzzle ids) for a given User:
curl -L 'http://localhost:8080/pmm-dev/api/v2/plays?series=demo-api&puzzleIds=123ba400,46892ef6&userId=9f7439e7-ecf1-4c03-ba90-91273f149231' \
-H 'Accept: application/json'
All Plays for a given User for a given series:
curl -L 'http://localhost:8080/pmm-dev/api/v2/plays?series=demo-api&userId=9f7439e7-ecf1-4c03-ba90-91273f149231' \
-H 'Accept: application/json'
Request
Responses
- 200
- 400
- 401
- 403
- 500
- 503
List of plays with puzzle type specific state details.
Each play includes common fields and a playProgress object containing
puzzle type specific statistics and progress information.
Bad request. Possible errorCode values for this endpoint:
INVALID_PARAMETER(116) — generic input validation; conditions include:userIdis missing.seriesis missing.puzzleIdscount exceeds 30.fromortois provided but not in ISO 8601 format with a timezone offset. (Each is independently optional; supplying only one is allowed and the other defaults.)- Both
fromandtoare provided andfromis later thanto.
Caller is not authenticated.
Possible errorCode values:
UNAUTHENTICATED_ACCESS(108) — noAuthorizationheader presented.EXPIRED_TOKEN(98) — bearer token expired.INVALID_TOKEN(99) — bearer token malformed or signature invalid.
Caller is authenticated but not allowed to perform this operation.
Possible errorCode values:
NO_ACCESS_TO_SET(84)NO_WRITE_ACCESS_TO_SET(85)CONTENT_SET_NOT_WRITABLE(87)PERMISSION_DENIED(114)ACCOUNT_EXPIRED(95)INACTIVE_USER(137)
An internal server error occurred while processing the request.
Possible errorCode values include IO_FAILURE (128) and other internal failures.
The service is temporarily unavailable, typically due to scheduled database maintenance.
Possible errorCode value: DB_DISABLED (130).