SDG Tic Tac Toe

SDG Tic Tac Toe
Contact Info: gavin@suncoast.io
Version: 1.0.0

Access

Methods

[ Jump to Models ]

Table of Contents

Default

Default

Up
get /game/{id}
Get the state of a current game (gameIdGet)
Retrieves the current state of a game

Path parameters

id (required)
Path Parameter — Game ID

Return type

GameBoard

Example data

Content-Type: application/json
{
  "winner" : "X",
  "id" : 42,
  "board" : "[ [ \" \", \" \", \" \" ],     [ \" \", \" \", \" \" ],      [ \" \", \" \", \" \" ] ]\n"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

Game Board GameBoard

404

Game ID not found

Up
post /game/{id}
Records a player's move (gameIdPost)
Supply the user's move and receive back a board with the user's and the computer's move

Path parameters

id (required)
Path Parameter — Game ID

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

body body (required)
Body Parameter

Return type

GameBoard

Example data

Content-Type: application/json
{
  "winner" : "X",
  "id" : 42,
  "board" : "[ [ \" \", \" \", \" \" ],     [ \" \", \" \", \" \" ],      [ \" \", \" \", \" \" ] ]\n"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

Game Board GameBoard

400

User's move is invalid

404

Game ID not found

Up
post /game
Creates a new Tic Tac Toe Game (gamePost)
This will setup a new game and return an initial board along with a game ID

Return type

GameBoard

Example data

Content-Type: application/json
{
  "winner" : "X",
  "id" : 42,
  "board" : "[ [ \" \", \" \", \" \" ],     [ \" \", \" \", \" \" ],      [ \" \", \" \", \" \" ] ]\n"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

Game Board GameBoard

Models

[ Jump to Methods ]

Table of Contents

  1. GameBoard
  2. body

GameBoard Up

id (optional)
BigDecimal Game board identifier
example: 42
winner (optional)
String Winner (X or O or TIE)
example: X
board (optional)
array[Object] 3x3 array of either a " " (no move), "X", or "O"
example: [ [ " ", " ", " " ], [ " ", " ", " " ], [ " ", " ", " " ] ]

body Up

row (optional)
Integer 0 based row index for player's move
column (optional)
Integer 0 based row index for player's move