Understand how to play a round of Wizard using API calls.
At any time, details of the round can be fetched from the API.
To see how many rounds are in the current game, fetch the game details.
GET /api/game/{gameId}
Authorization: Bearer <token>
X-Wizard-Client-Type: <your-client-id>
Response:
{
"gameId": "string",
"gameName": "string",
"players": [
{
"playerId": "string",
"name": "string",
"joinState": "Invited"
}
],
"maxRounds": 1073741824,
"rounds": [
{
"id": "string",
"roundNumber": 1073741824,
"winEstimates": [
{
"playerId": "string",
"name": "string",
"estimate": 1073741824
}
],
"dominantCard": {
"color": "string",
"value": 1073741824
},
"handsCompleted": 1073741824,
"roundCompleted": true,
"nextAction": {
"action": "EstimateWins",
"playerId": "string",
"name": "string"
},
"roundScore": [
{
"playerId": "string",
"name": "string",
"score": 1073741824
}
]
}
],
"totalScore": [
{
"playerId": "string",
"name": "string",
"score": 1073741824
}
],
"gameEnded": true
}
When all invites are accepted, the first round can be started.
Call the endpoint to start the round, replacing the gameId
with the ID of the game.
It will return the state of the game, including a newly created round.
POST /api/game/{gameId}/startround
Authorization: Bearer <token>
X-Wizard-Client-Type: <your-client-id>
To participate in gameplay, clients must frequently check the current state of the round.
It contains all the information you need to play the card game round.
The field nextAction
defines what’s expected and by which player.
Replace the gameId
and roundId
with the respective IDs applicable.
GET /api/game/{gameId}/round/{roundId}
Authorization: Bearer <token>
X-Wizard-Client-Type: <your-client-id>
Response:
{
"id": "string",
"roundNumber": 1073741824,
"winEstimates": [
{
"playerId": "string",
"name": "string",
"estimate": 1073741824
}
],
"handWins": [
{
"playerId": "string",
"name": "string",
"score": 1073741824
}
],
"dominantCard": {
"color": "string",
"value": 1073741824
},
"playerHand": [
{
"color": "string",
"value": 1073741824
}
],
"currentDraw": [
{
"playerId": "string",
"name": "string",
"playedCard": {
"color": "string",
"value": 1073741824
}
}
],
"nextAction": {
"action": "EstimateWins",
"playerId": "string",
"name": "string"
},
"roundCompleted": true,
"roundScore": [
{
"playerId": "string",
"name": "string",
"score": 1073741824
}
]
}
Depending on the value of nextAction
, the player can perform an action in the round.
The player can either estimate the amount of wins in this round, or play a card from their hand.
When calling either endpoint successfully, the updated round state will be returned.
In case of an error, the response can be JSON-decoded for details.
POST /api/game/{gameId}/round/{roundId}/estimate
Authorization: Bearer <token>
X-Wizard-Client-Type: <your-client-id>
{
"playerId": "string",
"estimate": 1073741824
}
POST /api/game/{gameId}/round/{roundId}/play
Authorization: Bearer <token>
X-Wizard-Client-Type: <your-client-id>
{
"playerId": "string",
"card": {
"color": "string",
"value": 1073741824
}
}
flowchart LR A[Fetch Round State] --> B{Is it my turn?} B -- No --> A B -- Yes --> C[Next Action?] C -- Estimate --> D[POST /round/estimate] C -- Play Card --> E[POST /round/play-card] D --> A E --> A