Skip to content
moxon home

Tic-Tac-Toe Play

The /tic-tac-toe/:game endpoint plays a move in an existing game using a REST method.

patchhttps://api.moxon.dev/v4/tic-tac-toe/:game
Try itpatch/v4/tic-tac-toe/:game

Parameters

  • gamestringrequired

    The game identifier (URL parameter)

  • usernamestringrequired

    The username making the move

  • movestringrequired

    The move played (e.g., 1-1, 2-2, 3-3)

  • sessionstringrequired

    The user's session identifier

Good to know

The game parameter is part of the URL path. The other parameters are sent as a JSON body with Content-Type: application/json.

Response Fields

  • messagestring

    Status message about the move

  • winnerstring|null

    Username of the winner (if game is over)

  • loserstring|null

    Username of the loser (if game is over)

  • tieboolean

    Whether the game ended in a tie

Code Examples

Error Handling

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

  • 400Invalid move. Please provide a valid move (e.g., 1-1, 2-2, 3-3).Invalid move format
  • 400Game is full, you can only watch.Game already has two players
  • 400Please wait for the other player to make a move.Not your turn
  • 400Move already made. Please choose a different move.Cell already occupied
  • 400Session ID mismatchSession doesn't match the player