Finished RestApi
This commit is contained in:
parent
5c4e981b16
commit
e52b9270b7
@ -11,63 +11,114 @@ servers:
|
|||||||
paths:
|
paths:
|
||||||
/ping:
|
/ping:
|
||||||
get:
|
get:
|
||||||
summary: Test if the api is up.
|
summary: Vérifie l'état de l'api.
|
||||||
responses:
|
responses:
|
||||||
default:
|
default:
|
||||||
description: Standard response to ping
|
description: Retourne pong
|
||||||
content:
|
content:
|
||||||
text/plain:
|
text/plain:
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
example: pong
|
example: pong
|
||||||
/requests:
|
|
||||||
post:
|
|
||||||
summary: Faire une demande
|
|
||||||
tags:
|
|
||||||
- Student
|
|
||||||
responses:
|
|
||||||
'201':
|
|
||||||
description: Demande envoyée
|
|
||||||
/users:
|
/users:
|
||||||
get:
|
get:
|
||||||
summary: Listere les utilisateurs
|
summary: Liste les utilisateurs
|
||||||
tags:
|
tags:
|
||||||
- SI
|
- SI
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: type
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
enum: [teacher, student, secretary]
|
||||||
responses:
|
responses:
|
||||||
default:
|
'200':
|
||||||
description: Success
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/User"
|
||||||
|
'401':
|
||||||
|
$ref: '#/components/responses/UnauthorizedError'
|
||||||
|
|
||||||
/user: # registration
|
/user:
|
||||||
|
get:
|
||||||
|
summary: Récupére ses informations
|
||||||
|
tags:
|
||||||
|
- Users
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Ok
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/User"
|
||||||
post:
|
post:
|
||||||
summary: Créer un utilisateur
|
summary: Créer un utilisateur
|
||||||
tags:
|
tags:
|
||||||
- users
|
- Users
|
||||||
|
requestBody:
|
||||||
|
require: true
|
||||||
|
content:
|
||||||
|
application/x-www-form-urlencoded:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
LastName:
|
||||||
|
type: string
|
||||||
|
FirstName:
|
||||||
|
type: string
|
||||||
|
Email:
|
||||||
|
type: string
|
||||||
|
Address:
|
||||||
|
$ref: "#/components/schemas/Address"
|
||||||
|
BirthDate:
|
||||||
|
type: string
|
||||||
|
description: Follow the iso 8601 ("YYYY-MM-DD")
|
||||||
|
example:
|
||||||
|
{
|
||||||
|
"LastName": "Doe" ,
|
||||||
|
"FirstName": "John",
|
||||||
|
"Email": "John.Doe@example.com",
|
||||||
|
"Address": {
|
||||||
|
"Address": "Rue de Tounais 42",
|
||||||
|
"Country": "BE"},
|
||||||
|
"BirthDate": "1941-02-22",
|
||||||
|
}
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'201':
|
||||||
description: User created
|
description: User created
|
||||||
'401':
|
'401':
|
||||||
$ref: '#/components/responses/UnauthorizedError'
|
$ref: '#/components/responses/UnauthorizedError'
|
||||||
patch:
|
patch:
|
||||||
summary: modifier ses informations
|
summary: modifier ses informations
|
||||||
tags:
|
tags:
|
||||||
- users
|
- Users
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
|
requestBody:
|
||||||
|
require: true
|
||||||
|
content:
|
||||||
|
application/x-www-form-urlencoded:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'201':
|
||||||
description: Informaitions modifiées
|
description: Informations modifiées
|
||||||
'401':
|
'401':
|
||||||
$ref: '#/components/responses/UnauthorizedError'
|
$ref: '#/components/responses/UnauthorizedError'
|
||||||
/user/{mat}:
|
/user/{mat}:
|
||||||
get:
|
get:
|
||||||
summary: get user's info
|
summary: Récupérer les informations d'un utilisateur
|
||||||
tags:
|
tags:
|
||||||
- Admin
|
- Admin
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: User found
|
description: Utilisateur trouvé
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
@ -85,65 +136,56 @@ paths:
|
|||||||
- Admin
|
- Admin
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
|
requestBody:
|
||||||
|
require: true
|
||||||
|
content:
|
||||||
|
application/x-www-form-urlencoded:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'201':
|
||||||
description: Informaitions modifiées
|
description: Informations modifiées
|
||||||
'401':
|
'401':
|
||||||
$ref: '#/components/responses/UnauthorizedError'
|
$ref: '#/components/responses/UnauthorizedError'
|
||||||
|
|
||||||
/users/requests:
|
/course:
|
||||||
get:
|
post:
|
||||||
summary: Lister les requetes d'utilisateurs
|
summary: Créer un nouveau cours
|
||||||
|
tags:
|
||||||
|
- Courses
|
||||||
|
- Secretariat
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
tags:
|
requestBody:
|
||||||
- Secretaria
|
require: true
|
||||||
- SI
|
content:
|
||||||
|
application/x-www-form-urlencoded:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
courses:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'201':
|
||||||
description: Liste les requètes
|
description: Nouveau cours crée
|
||||||
|
|
||||||
|
|
||||||
/user/{mat}/validate/{id}:
|
|
||||||
patch:
|
|
||||||
summary: Valider un utilisateur
|
|
||||||
tags:
|
|
||||||
- Secretaria
|
|
||||||
- SI
|
|
||||||
security:
|
|
||||||
- bearer: []
|
|
||||||
parameters:
|
|
||||||
- name: mat
|
|
||||||
in: path
|
|
||||||
description: matricule de l'utilisateur
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
type: integer
|
|
||||||
- name: id
|
|
||||||
in: path
|
|
||||||
description: Identifiant de la demande
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
type: integer
|
|
||||||
- name: answer
|
|
||||||
in: header
|
|
||||||
description: valide l'utilisateur ou non
|
|
||||||
schema:
|
|
||||||
type: boolean
|
|
||||||
responses:
|
|
||||||
'200':
|
|
||||||
description: Informaitions modifiées
|
|
||||||
'401':
|
'401':
|
||||||
$ref: '#/components/responses/UnauthorizedError'
|
$ref: '#/components/responses/UnauthorizedError'
|
||||||
|
|
||||||
/courses/{id}:
|
/courses/{id}:
|
||||||
get:
|
get:
|
||||||
summary: Voir les informations sur un cours*
|
summary: Voir les informations sur un cours
|
||||||
tags:
|
tags:
|
||||||
- Courses
|
- Courses
|
||||||
responses:
|
responses:
|
||||||
'202':
|
'200':
|
||||||
description: success
|
description: OK
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Course'
|
||||||
parameters:
|
parameters:
|
||||||
- name: id
|
- name: id
|
||||||
in: path
|
in: path
|
||||||
@ -154,49 +196,107 @@ paths:
|
|||||||
summary: Suprimer un cours
|
summary: Suprimer un cours
|
||||||
tags:
|
tags:
|
||||||
- Courses
|
- Courses
|
||||||
- Secretaria
|
- Secretariat
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
responses:
|
responses:
|
||||||
'202':
|
'201':
|
||||||
description: success
|
description: Success
|
||||||
|
'401':
|
||||||
|
$ref: '#/components/responses/UnauthorizedError'
|
||||||
patch:
|
patch:
|
||||||
summary: Changer les options du cours
|
summary: Changer les options du cours
|
||||||
tags:
|
tags:
|
||||||
- Secretaria
|
- Secretariat
|
||||||
- Courses
|
- Courses
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
parameters:
|
requestBody:
|
||||||
- name: professeur
|
require: true
|
||||||
in: header
|
content:
|
||||||
required: true
|
application/x-www-form-urlencoded:
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: object
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
credits:
|
||||||
|
type: integer
|
||||||
|
faculty:
|
||||||
|
type: string
|
||||||
|
teachers:
|
||||||
|
type: object
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
assistants:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
example:
|
||||||
|
{
|
||||||
|
"name": "Math pour l'info",
|
||||||
|
"credits": 11,
|
||||||
|
"faculty": "science",
|
||||||
|
"Teacher": ,
|
||||||
|
"Assistants": [ ]
|
||||||
|
}
|
||||||
responses:
|
responses:
|
||||||
'202':
|
'201':
|
||||||
description: Bien ouej
|
description: Cours modifié
|
||||||
|
'401':
|
||||||
|
$ref: '#/components/responses/UnauthorizedError'
|
||||||
|
|
||||||
/cursus:
|
/cursus:
|
||||||
post:
|
post:
|
||||||
summary: Créer un nouveau cours
|
summary: Créer un nouveau cursus
|
||||||
tags:
|
tags:
|
||||||
- cursus
|
- cursus
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
|
requestBody:
|
||||||
|
require: true
|
||||||
|
content:
|
||||||
|
application/x-www-form-urlencoded:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
credits:
|
||||||
|
type: integer
|
||||||
|
faculty:
|
||||||
|
type: string
|
||||||
|
teachers:
|
||||||
|
type: object
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
assistants:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
example:
|
||||||
|
{
|
||||||
|
"name": "Math pour l'info",
|
||||||
|
"credits": 11,
|
||||||
|
"faculty": "science",
|
||||||
|
"Teacher": ,
|
||||||
|
"Assistants": [ ]
|
||||||
|
}
|
||||||
responses:
|
responses:
|
||||||
'202':
|
'201':
|
||||||
description: success
|
description: Nouveau cursus crée
|
||||||
|
'401':
|
||||||
|
$ref: '#/components/responses/UnauthorizedError'
|
||||||
/cursus/{id}:
|
/cursus/{id}:
|
||||||
get:
|
get:
|
||||||
summary: Voir les informations sur un cursus
|
summary: Voir les informations sur un cursus
|
||||||
tags:
|
tags:
|
||||||
- cursus
|
- cursus
|
||||||
responses:
|
responses:
|
||||||
'202':
|
'200':
|
||||||
description: success
|
description: OK
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Cursus'
|
||||||
parameters:
|
parameters:
|
||||||
- name: id
|
- name: id
|
||||||
in: path
|
in: path
|
||||||
@ -210,29 +310,49 @@ paths:
|
|||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
responses:
|
responses:
|
||||||
'202':
|
'201':
|
||||||
description: success
|
description: Success
|
||||||
|
'401':
|
||||||
|
$ref: '#/components/responses/UnauthorizedError'
|
||||||
patch:
|
patch:
|
||||||
summary: Changer les options du cursus
|
summary: Changer les options du cursus
|
||||||
tags:
|
tags:
|
||||||
- cursus
|
- cursus
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
|
requestBody:
|
||||||
|
require: true
|
||||||
|
content:
|
||||||
|
application/x-www-form-urlencoded:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
credits:
|
||||||
|
type: integer
|
||||||
|
faculty:
|
||||||
|
type: string
|
||||||
|
teachers:
|
||||||
|
type: object
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
assistants:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
example:
|
||||||
|
{
|
||||||
|
"name": "Math pour l'info",
|
||||||
|
"credits": 11,
|
||||||
|
"faculty": "science",
|
||||||
|
"Teacher": ,
|
||||||
|
"Assistants": [ ]
|
||||||
|
}
|
||||||
responses:
|
responses:
|
||||||
'202':
|
'201':
|
||||||
description: Bien ouej
|
description: Cours modifié
|
||||||
|
'401':
|
||||||
/courses:
|
$ref: '#/components/responses/UnauthorizedError'
|
||||||
post:
|
|
||||||
summary: Créer un nouveau cours
|
|
||||||
tags:
|
|
||||||
- Courses
|
|
||||||
- Secretaria
|
|
||||||
security:
|
|
||||||
- bearer: []
|
|
||||||
responses:
|
|
||||||
'202':
|
|
||||||
description: success
|
|
||||||
|
|
||||||
|
|
||||||
components:
|
components:
|
||||||
@ -244,54 +364,81 @@ components:
|
|||||||
User:
|
User:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
RegNo:
|
regNo:
|
||||||
type: integer
|
type: integer
|
||||||
Photo:
|
photo:
|
||||||
type: object
|
type: object
|
||||||
LastName:
|
lastName:
|
||||||
type: string
|
type: string
|
||||||
FirstName:
|
firstName:
|
||||||
type: string
|
type: string
|
||||||
Email:
|
email:
|
||||||
type: string
|
type: string
|
||||||
Address:
|
address:
|
||||||
$ref: "#/components/schemas/Address"
|
$ref: "#/components/schemas/Address"
|
||||||
BirthDate:
|
birthDate:
|
||||||
type: string
|
type: string
|
||||||
description: Follow the iso 8601 ("YYYY-MM-DD")
|
description: Follow the iso 8601 ("YYYY-MM-DD")
|
||||||
StaffMember:
|
|
||||||
type: boolean
|
|
||||||
example:
|
example:
|
||||||
{
|
{
|
||||||
"RegNo": 42,
|
"regNo": 42,
|
||||||
"LastName": "Doe" ,
|
"lastName": "Doe" ,
|
||||||
"FirstName": "John",
|
"firstName": "John",
|
||||||
"Email": "John.Doe@example.com",
|
"email": "John.Doe@example.com",
|
||||||
"Address": {
|
"address": {
|
||||||
"Address": "Rue de Tounais 42",
|
"address": "Rue de Tounais 42",
|
||||||
"Country": "BE"},
|
"country": "BE"},
|
||||||
"BirthDate": "1941-02-22",
|
"birthDate": "1941-02-22",
|
||||||
"StaffMember": true,
|
"staffMember": true,
|
||||||
}
|
}
|
||||||
Address:
|
Address:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
Address:
|
address:
|
||||||
type: string
|
type: string
|
||||||
Country:
|
country:
|
||||||
type: string
|
type: string
|
||||||
description: Follow the ISO-3166-1 alpha-2 standard.
|
description: Follow the ISO-3166-1 alpha-2 standard.
|
||||||
example:
|
example:
|
||||||
{
|
{
|
||||||
"Address": "Rue de Tounais 42",
|
"address": "Rue de Tounais 42",
|
||||||
"Country": "BE"
|
"country": "BE"
|
||||||
|
}
|
||||||
|
Course:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
credits:
|
||||||
|
type: integer
|
||||||
|
faculty:
|
||||||
|
type: string
|
||||||
|
teachers:
|
||||||
|
type: object
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
assistants:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
example:
|
||||||
|
{
|
||||||
|
"id": 42,
|
||||||
|
"name": "Math pour l'info",
|
||||||
|
"credits": 11,
|
||||||
|
"faculty": "science",
|
||||||
|
"Teacher": ,
|
||||||
|
"Assistants": [ ]
|
||||||
}
|
}
|
||||||
Cursus:
|
Cursus:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
Id:
|
id:
|
||||||
type: integer
|
type: integer
|
||||||
Courses:
|
name:
|
||||||
|
type: string
|
||||||
|
courses:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
@ -302,4 +449,4 @@ components:
|
|||||||
}
|
}
|
||||||
responses:
|
responses:
|
||||||
UnauthorizedError:
|
UnauthorizedError:
|
||||||
description: Access token is missing or invalid
|
description: Permission non accordée
|
||||||
|
Loading…
Reference in New Issue
Block a user