Skip to main content
The number of battles with the needed status can be retrieved by calling getBattles query. However, if you need to get the aggregated battles statistics for a specific user context, getUserBattlesStatistics query can be executed. The returned data includes the key-value pairs that represent the number of battles by status for the given user context. The query has one optional argument userContextId. If it is omitted, the battles will be retrieved for the current API user context.
Only users associated with the ADMINISTRATOR scope can view the other user’s battle statistics.
Query execution example:
query getUserBattlesStatistics {
  getUserBattlesStatistics {
    key
    value
  }
}
The list of the returned keys is always the same:
  1. TOTAL_BATTLES_NUMBER - represents the battles taken by the current user; also includes the pending battles.
  2. PENDING_BATTLES_NUMBER - represents the battles where the user has been selected as an opponent but did not start them yet.
  3. WON_BATTLES_NUMBER - represents the battles that the user has won.
  4. LOST_BATTLES_NUMBER - represents the battles that the user has lost.
  5. DRAW_BATTLES_NUMBER - represents the battles finished as a tie (both rivals earned the same number of points and spent the same amount of time).