5 api_doc
RemRem edited this page 1 year ago

Documentation API

User

Création du compte

Requete:

POST /user
Header(Content-Type: application/json)
{
"email":"EMAIL",
"hash":"HASH",
"username":"USERNAME"
}

Réponse:

200 OK + {"token":"TOKEN"}
409 CONFLICT - Déja un compte avec cet email
400 BAD REQUEST - Json mal formaté

Suppression compte

Requete:

DELETE /user
Header(Authorization: TOKEN)

Réponse:

200 OK
401 UNAUTHORIZED - Mauvais ou pas de token
404 NOT FOUND - Pas de compte lié

Connexion

Requete:

GET /user/login/{email}/{hash}

Réponse:

200 OK + {"token":"TOKEN"}
401 UNAUTHORIZED

Info du compte

Requete:

GET /user/info
header(Authorization: TOKEN)

Réponse:

200 OK {"email":"EMAIL","username":"USERNAME"}
401 UNAUTHORIZED
404 NOT FOUND

Modification Attribut

X peut etre remplacé "email" et "username" Requete:

PUT /user/X
Header(
Authorization: TOKEN
Content-Type: application/json)
{"X":"X"}

Réponse:

200 OK
400 BAD REQUEST
401 UNAUTHORIZED

File

Upload

Requete:

POST /user/files
Header(Authorization: TOKEN)
https://stackoverflow.com/questions/71424265/how-to-send-multipart-file-with-flutter

Réponse:

200 OK
400 BAD REQUEST
401 UNAUTHORIZED
409 CONFLICT

Download

Requete:

GET /user/files/{file_uuid}
Header(Authorization: TOKEN)

Réponse:

200 OK + Stream du fichier
401 UNAUTHORIZED
404 NOT FOUND

Supprime fichier

Requete:

DELETE /user/files/{file_uuid}
Header(Authorization: TOKEN)

Réponse:

200 OK
401 UNAUTHORIZED
404 NOT FOUND

Liste tout les fichiers

Requete:

GET /user/files
Header(Authorization: TOKEN)

Réponse:

200 OK + [{"uuid":"UUID", "filename":"FILENAME"}]
401 UNAUTHORIZED