Skip to content

Tic-Tac-Toe Fetch

The /tic-tac-toe/fetch endpoint retrieves information about a current Tic-Tac-Toe game.

Parameters

ParameterRequiredDescription
usernameYesThe username of the player
gameNoThe game identifier to fetch
privateNoSet to true to fetch only private games

Code Examples

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "username": "User1",
    "game": "VWXYZ"
  }' \
  "https://api.sylvain.sh/v4/tic-tac-toe/fetch"

Response Fields

FieldTypeDescription
idstringGame identifier
movesarrayArray of moves made in the game
playersstring[]Array of player usernames
turnstring|nullUsername of the player whose turn it is
statusstringGame status (waiting or ready)
privatebooleanWhether the game is private
winnerstring|nullUsername of the winner (if game is over)
loserstring|nullUsername of the loser (if game is over)
tiebooleanWhether the game ended in a tie

Try It

Error Handling

If parameters are missing or invalid, the API will return an error:

Error MessageDescription
Please provide a username (?username={username})The username parameter is missing