Get series specific user stats
GET/api/v2/user-stats
Fetches aggregated stats for a user given a series — how many puzzles they have started, how many they have completed, and how consistently they have played (streaks).
Streak Definition: A streak counts how many consecutive published puzzles a user has started or completed without missing one. Streaks follow the publication order of puzzles in the series:
- Started streak: A puzzle contributes to the started streak when the user has at least one play record for it. The streak increments with each successive published puzzle the user starts. The streak breaks as soon as there is a published puzzle the user has not started yet.
- Completed streak: A puzzle contributes to the completed streak when the user solves it before the next puzzle in the series is published. The streak increments with each successive puzzle the user completes on time. The streak breaks when a puzzle is published and the preceding puzzle had not been completed before that publication date.
currentStreak reflects the active, unbroken streak counted from the most recent puzzle in
the series back to the first missed puzzle. longestStreak is the highest streak the user
has ever achieved for this series.
Examples:
Get user stats for a series:
curl -L 'https://sandbox.amuselabs.com/pmm/api/v2/user-stats?series=demo-api&userId=9f7439e7-ecf1-4c03-ba90-91273f149231' \
-H 'Authorization: Bearer YOUR_JWT_TOKEN' \
-H 'Accept: application/json'
Request
Responses
- 200
- 400
- 401
- 403
- 500
- 503
Successful response with user stats object
Bad request. Possible errorCode values for this endpoint:
INVALID_PARAMETER(116) — generic input validation; conditions include:userIdis missing.seriesis missing.
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 access the requested resource. Possible errorCode values for this endpoint:
NO_ACCESS_TO_SET(84) — caller has no access to the requested series.DISALLOWED_OPERATION(88) — the user-stats API is not enabled for the requested series.
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).