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

Request Example

bash
curl -X POST -d "username=User1&game=VWXYZ" "https://api.sylvain.sh/v3/tic-tac-toe/fetch"

Response

json
{
    "game": "VWXYZ",
    "players": ["User1", "User2"],
    "board": [
        ["X", "", "O"],
        ["", "X", ""],
        ["O", "", ""]
    ],
    "current_turn": "User2",
    "status": "in_progress",
    "private": false,
    "created_at": "2025-01-21T10:30:00.000Z"
}

Response Fields

FieldDescription
gameGame identifier
playersArray of player usernames
board3x3 array representing the game board
current_turnUsername of the player whose turn it is
statusGame status (waiting, in_progress, finished)
privateWhether the game is private
created_atGame creation timestamp

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