Tic-Tac-Toe Forfeit
The /tic-tac-toe/:game endpoint forfeits (abandons) a game.
DELETE/v5/tic-tac-toe/:game
Parameters
| Parameter | Required | Description |
|---|---|---|
game | Yes | The game identifier (URL parameter) |
username | Yes | The username forfeiting |
session | Yes | 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
| Field | Type | Description |
|---|---|---|
message | string | Confirmation of the forfeit |
winner | string | Username of the winner (opponent) |
loser | string | Username of the player who forfeit |
Code Examples
curl -X DELETE \
-H "Content-Type: application/json" \
-d '{
"username": "alice",
"session": "abc123"
}' \
"https://api.sylvain.sh/v5/tic-tac-toe/VWXYZ"Try It
Error Handling
If parameters are missing or invalid, the API will return an error:
| Error Message | Description |
|---|---|
Session ID mismatch | Session doesn't match the player |
Related Endpoints
- POST /v5/tic-tac-toe - Main game endpoint for making moves
- PATCH /v5/tic-tac-toe/:game - Play a move
- POST /v5/tic-tac-toe/fetch - Retrieve current game information
- POST /v5/tic-tac-toe/list - List all public games