InstaQuiz
Github
  • Introduction
  • Setup
    • Requirements
    • Environment setup
    • Testing
  • Database
    • Schema
    • Setup
  • Server
    • Folder structure
    • Code structure
    • API Reference
  • Client
    • Folder structure
    • Code structure
  • deployment
    • Your own server
    • Fly.io
Powered by GitBook
On this page
  • Users
  • Insert or update user
  • Categories
  • Get list of categories
  • Games
  • Get game
  • Create new game
  1. Server

API Reference

Users

Insert or update user

Path

/users/create

Method

POST

Headers

Body

Result code

201 Success | 500 Error

Result body

Categories

Get list of categories

Path

/categories

Method

GET

Headers

Result code

200 Success | 500 Error

Success body

Error body

Games

Get game

Get game info by id

Path

/games/:id

Method

GET

Headers

Result code

200 Success | 404 Not found | 500 Error

Success body

Error body

Create new game

Create using user id and category id

Path

/games/create

Method

POST

Headers

Body

Result code

201 Created | 409 Already exists | 500 Error

Response body

PreviousCode structureNextFolder structure

Last updated 1 year ago

{
    "Authorization": "Bearer ...",
    "Content-Type": "application/json"
}
{
    "id": 5,
    "first_name": "James",
    "last_name": "Martin",
    "username": "james",
    "is_bot": false,
    "language_code": "en",
    "is_premium": false,
    "added_to_attachment_menu": false,
    "allows_write_to_pm": false,
    "photo_url": null
}
{
    "message": "result",
}
{
    "Authorization": "Bearer ..."
}
[
    {
        "id": 1,
        "name": "Animals",
        "created_at": "2023-09-27T05:40:33.870Z",
        "updated_at": "2023-09-27T05:40:33.870Z"
    },
    ...
]
{
    "message": "error",
}
{
    "Authorization": "Bearer ..."
}
{
    "id": 15,
    "owner_id": 5,
    "category_id": 11,
    "status": 0,
    "user_first_name": "James", // Game creator info
    "user_last_name": "Martin",
    "category_name": "Sports"
}
{
    "message": "error",
}
{
    "Authorization": "Bearer ...",
    "Content-Type": "application/json",
}
{
    "userId": 5,
    "categoryId": 1
}
{
    "message": "result",
}