214 lines
5.7 KiB
YAML
214 lines
5.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://127.0.0.1:5000/api/v1
|
|
description: local server
|
|
- url: http://api.example.com/api/v1
|
|
description: prduction server
|
|
|
|
tags:
|
|
- name: Auth
|
|
description: Authentication endpoints
|
|
- name: User
|
|
description: User data endpoints
|
|
- name: Quiz
|
|
description: Quiz endpoints
|
|
|
|
paths:
|
|
/login:
|
|
post:
|
|
summary: Login
|
|
description: Login to the application
|
|
tags:
|
|
- Auth
|
|
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"
|
|
|
|
/login/google:
|
|
post:
|
|
summary: Login with Google
|
|
description: Login to the application using Google
|
|
tags:
|
|
- Auth
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
token_id:
|
|
type: string
|
|
example: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6Im91a2VuemV1bWFzaW9AZ21haWwuY29tIiwiZXhwIjoxNjIwNzQwNjY3LCJlbWFpbCI6Im91a2VuemV1bWFzaW9AZ21haWwuY29tIn0.7"
|
|
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 token"
|
|
/logout:
|
|
post:
|
|
summary: Logout
|
|
description: Logout from the application
|
|
tags:
|
|
- Auth
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
message:
|
|
type: string
|
|
example: "Logout successfully"
|
|
|
|
/register:
|
|
post:
|
|
summary: Register
|
|
description: Register to the application
|
|
tags:
|
|
- User
|
|
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"
|
|
/user:
|
|
get:
|
|
summary: Get User
|
|
description: Get user data
|
|
tags:
|
|
- User
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
id:
|
|
type: integer
|
|
example: 1
|
|
name:
|
|
type: string
|
|
example: "Oukenze"
|
|
email:
|
|
type: string
|
|
example: "oukenzeumasio"
|
|
put:
|
|
summary: Update User
|
|
description: Update user data
|
|
tags:
|
|
- User
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
email:
|
|
type: string
|
|
example: ""
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
message:
|
|
type: string
|
|
example: "User updated successfully"
|
|
|