From dd7e6071569688eb54d34ba03144526ea16fe85c Mon Sep 17 00:00:00 2001 From: RemRem Date: Thu, 9 Nov 2023 08:53:31 +0100 Subject: [PATCH] ajout api doc --- api.md | 1 + api_doc.md | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 api_doc.md diff --git a/api.md b/api.md index 60f823d..ef75729 100644 --- a/api.md +++ b/api.md @@ -1,4 +1,5 @@ # API +[**Documentation de l'API**](api_doc) ## Links - [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) diff --git a/api_doc.md b/api_doc.md new file mode 100644 index 0000000..02bd1ee --- /dev/null +++ b/api_doc.md @@ -0,0 +1,121 @@ +# 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 +``` + +### 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) +``` + +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 +``` \ No newline at end of file