TIF_E41211115_Genso_quiz_ba.../docs/rest_api_docs.yaml

96 lines
2.7 KiB
YAML

openapi: 3.0.4
info:
title: Quiz Maker API
description: API documentation for Quiz App
version: 1.0.0
servers:
- url: http://api.example.com/v1
description: Optional server description, e.g. Main (production) server
- url: http://127.0.0.1:5000/api
description: local server
paths:
/login:
post:
summary: Login
description: Login to the application
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
email:
type: string
example: "oukenzeumasio@gmail.com"
password:
type: string
example: "rahasia"
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
token:
type: string
example: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6Im91a2VuemV1bWFzaW9AZ21haWwuY29tIiwiZXhwIjoxNjIwNzQwNjY3LCJlbWFpbCI6Im91a2VuemV1bWFzaW9AZ21haWwuY29tIn0.7"
"400":
description: Bad Request
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: "Invalid email or password"
/register:
post:
summary: Register
description: Register to the application
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
email:
type: string
example: "oukenzeumasio@gmail.com"
password:
type: string
example: "rahasia"
name:
type: string
example: "Oukenze"
birth_date:
type: string
example: "09-09-1999"
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: "User created successfully"
"409":
description: Bad Request
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: "Email already registered"