Quiz API

A REST API for multiplayer quiz games. Register players, manage a question bank, open a lobby, and run rounds where everyone answers the same question at the same time.

What it does

Quick start

# create a player
curl -X POST https://quiz-api.vitali.live/api/users \
  -H 'Content-Type: application/json' \
  -d '{"nickname":"ada","password":"secret123"}'

# log in
TOKEN=$(curl -s -X POST https://quiz-api.vitali.live/api/auth/login \
  -H 'Content-Type: application/json' \
  -d '{"nickname":"ada","password":"secret123"}' | jq -r .accessToken)

# open a game
curl -X POST https://quiz-api.vitali.live/api/games \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"playersLimit":4,"questionsCount":10}'

Endpoints

Auth

POST/api/auth/loginExchange credentials for a token

Users

POST/api/usersRegister
GET/api/usersList all (admin)
GET/api/users/{id}Fetch one
PATCH/api/users/{id}Update own profile
DELETE/api/users/{id}Delete own profile

Questions (admin)

POST/api/questionsCreate
POST/api/questions/bulkCreate many at once
GET/api/questionsList all
GET/api/questions/{id}Fetch one
PATCH/api/questions/{id}Update
DELETE/api/questions/{id}Delete

Games

POST/api/gamesOpen a lobby
GET/api/gamesList games
GET/api/games/{id}Fetch one
PATCH/api/games/{id}Update settings (host, pre-start)
DELETE/api/games/{id}Delete (host, pre-start)
POST/api/games/{id}/joinJoin the lobby
POST/api/games/{id}/leaveLeave the lobby
POST/api/games/{id}/startStart the game
GET/api/games/{id}/questionCurrent question
POST/api/games/{id}/questionSubmit an answer

Categories

general · programming · geography · history · math · literature · music · movies · games · animals · vehicles · sports · politics · science · art · other