Get Leaderboard

GraphQL query:

query TournamentLeaderboard(
  $tournamentId: ID!, 
  $playerIds: [ID!]! 
  $skip: Int = 0, 
  $take: Int = 200, 
  $groupId: String = null, 
  ) {
  node(id: $tournamentId) {
    ... on CourseTournament {
      leaderboard(participantGroupId: $groupId) {
        records(skip: $skip, take: $take) {
          items {
            ... LeaderboardPlayer
          }
          pageInfo {
            hasNextPage
            hasPreviousPage
          }
          totalCount
        }
        selectedPlayers(ids: $playerIds) {
          ... LeaderboardPlayer
        }
      }
    }
  }
}

fragment LeaderboardPlayer on LeaderboardRecord
{
  playername
  playerId
  picture
  nationality
  gender
  hcp
  total {
    ... LeaderboardTotal
  }
  latestRound {
    ... LeaderboardRound
  }
  rounds {
    ... LeaderboardRound
  }
}

fragment LeaderboardTotal on LeaderboardTotalScore
{
  pos
  posLabel
  score
  state
  toPar
  thru
}

fragment LeaderboardRound on LeaderboardRoundScoreType
{
  scorecardId
  pos
  posLabel
  score
  state
  roundNumber
  roundState
  thru
  toPar
}

Variables:

{
    "tournamentId": "<Your Tournament ID>",
    "playerIds": []
}

Example of response:

{
    "data": {
        "node": {
            "leaderboard": {
                "records": {
                    "items": [
                        {
                            "playername": "...",
                            "playerId": "...",
                            "picture": null,
                            "nationality": null,
                            "gender": null,
                            "hcp": 10,
                            "total": {
                                "pos": 1,
                                "posLabel": "T1",
                                "score": 185,
                                "state": "PLAYED",
                                "toPar": -31,
                                "thru": 9
                            },
                            "latestRound": {
                                "scorecardId": "...",
                                "pos": 4,
                                "posLabel": "4",
                                "score": 31,
                                "state": "PLAYED",
                                "roundNumber": 6,
                                "roundState": "STARTED",
                                "thru": 9,
                                "toPar": -5
                            },
                            "rounds": [
                                {
                                    "scorecardId": "...",
                                    "pos": 8,
                                    "posLabel": "8",
                                    "score": 32,
                                    "state": "PLAYED",
                                    "roundNumber": 1,
                                    "roundState": "STARTED",
                                    "thru": 9,
                                    "toPar": -4
                                },
                                {
                                    "scorecardId": "...",
                                    "pos": 4,
                                    "posLabel": "4",
                                    "score": 30,
                                    "state": "PLAYED",
                                    "roundNumber": 2,
                                    "roundState": "STARTED",
                                    "thru": 9,
                                    "toPar": -6
                                }
                            ]
                        },
                        {
                            "playername": "...",
                            "playerId": "...",
                            "picture": null,
                            "nationality": null,
                            "gender": null,
                            "hcp": 1,
                            "total": {
                                "pos": 1,
                                "posLabel": "T1",
                                "score": 185,
                                "state": "PLAYED",
                                "toPar": -31,
                                "thru": 9
                            },
                            "latestRound": {
                                "scorecardId": "...",
                                "pos": 7,
                                "posLabel": "7",
                                "score": 32,
                                "state": "PLAYED",
                                "roundNumber": 6,
                                "roundState": "STARTED",
                                "thru": 9,
                                "toPar": -4
                            },
                            "rounds": [
                                {
                                    "scorecardId": "...",
                                    "pos": 4,
                                    "posLabel": "4",
                                    "score": 31,
                                    "state": "PLAYED",
                                    "roundNumber": 1,
                                    "roundState": "STARTED",
                                    "thru": 9,
                                    "toPar": -5
                                },
                                {
                                    "scorecardId": "...",
                                    "pos": 10,
                                    "posLabel": "10",
                                    "score": 34,
                                    "state": "PLAYED",
                                    "roundNumber": 2,
                                    "roundState": "STARTED",
                                    "thru": 9,
                                    "toPar": -2
                                }
                            ]
                        }
                    ],
                    "pageInfo": {
                        "hasNextPage": true,
                        "hasPreviousPage": false
                    },
                    "totalCount": 2
                },
                "selectedPlayers": []
            }
        }
    }
}

Use the data.node.leaderboard.records.items.latestRound.scorecardId as Scorecard Id for accessing your the scorecard for the last rounds scorecard