OpenAPI#

Renders an OpenAPI 3.x specification as a documentation page. Operations are grouped by their first tag.

Syntax#

{{% openapi src="spec.json" %}}

The spec file is loaded via resources.Get, so the path is relative to the site’s assets/ directory. JSON and YAML are both supported.

Example#

This API allows writing down marks on a Tic Tac Toe board and requesting the state of the board or of individual squares.

v1.0.0

Security#

app2AppOauth
oauth2
Basic HTTP Authentication
basicHttpAuthentication
http Basic
Bearer token using a JWT
bearerHttpAuthentication
http Bearer JWT
API key provided in console
defaultApiKey
apiKey in header (api-key)
user2AppOauth
oauth2

Gameplay#

Get the whole board#

Retrieves the current state of the board and the winner.

Request (requires defaultApiKey, app2AppOauth)#

GET /board

Responses#

200: OK

Schema: status

Property Type Required Description
board board no
winner winner no Winner of the game. . means nobody has won yet.

Get a single board square#

Retrieves the requested square.

Request (requires bearerHttpAuthentication, user2AppOauth)#

GET /board/{row}/{column}

Path parameters#

Parameter name Value Description Additional
row coordinate Board row (vertical coordinate) Required, Example: 1
column coordinate Board column (horizontal coordinate) Required, Example: 1

Responses#

200: OK

Schema: mark

400: The provided parameters are incorrect

"Illegal coordinates"

Schema: errorMessage

Set a single board square#

Places a mark on the board and retrieves the whole board and the winner (if any).

Request (requires bearerHttpAuthentication, user2AppOauth)#

PUT /board/{row}/{column}

Path parameters#

Parameter name Value Description Additional
row coordinate Board row (vertical coordinate) Required, Example: 1
column coordinate Board column (horizontal coordinate) Required, Example: 1

Request body (required)#

Schema: mark

Responses#

200: OK

Schema: status

Property Type Required Description
board board no
winner winner no Winner of the game. . means nobody has won yet.

400: The provided parameters are incorrect

illegalCoordinates

"Illegal coordinates."

invalidMark

"Invalid Mark (X or O)."

notEmpty

"Square is not empty."

Schema: errorMessage

Models#

board#

Type: array of array of mark

coordinate#

Type: integer

errorMessage#

A text message describing an error

Type: string

mark#

Possible values for a board square. . means empty square.

Type: string (enum: ., X, O)

status#

Property Type Required Description
board board no
winner winner no Winner of the game. . means nobody has won yet.

winner#

Winner of the game. . means nobody has won yet.

Type: string (enum: ., X, O)