ajout api doc

master
remrem 1 year ago
parent ad62daf38f
commit dd7e607156

@ -1,4 +1,5 @@
# API
[**Documentation de l'API**](api_doc)
## Links
- [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete)

@ -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
```
Loading…
Cancel
Save