Created
October 19, 2023 11:58
-
-
Save vincentchalamon/7d1690b0191f0ce4b2074354bf0de941 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FORMAT: 1A | |
# Mon API de librairie | |
Pour tester, sauvegarder ce document dans un fichier library.apib | |
Installer l'outil de test `npm install -g drakov` | |
puis lancer la commande `drakov -f library.apib` | |
Testez votre API avec Insomnia. | |
# Ouvrages | |
## Ouvrages [/ouvrages] | |
Ouvrage empruntable | |
+ Model (application/ld+json) | |
```js | |
{ | |
"@context": "/contexts/Ouvrage", | |
"@id": "/ouvrages", | |
"@type": "hydra:Collection", | |
"hydra:totalItems": 1, | |
"hydra:member": [ | |
{ | |
"@id": "/ouvrages/01872fd0-b4cb-7878-ade7-f7d7e3675f25", | |
"@type": "https://schema.org/Book", | |
"id": "01872fd0-b4cb-7878-ade7-f7d7e3675f25", | |
"isbn": "9783498002589", | |
"title": "L'anomalie", | |
"author": "Hervé Le Tellier" | |
}, | |
] | |
} | |
``` | |
### Retourne tous les ouvrages [GET] | |
Retourne tous les ouvrages | |
+ Response 200 | |
+ Headers | |
Accept: application/ld+json | |
[Ouvrages][] | |
## Ouvrage [/ouvrages/{id}] | |
Ouvrage empruntable | |
+ Parameters | |
+ id: `01872fd0-b4cb-7878-ade7-f7d7e3675f25` (string) - UUID de l'ouvrage | |
+ Model (application/ld+json) | |
```js | |
{ | |
"@context": "/contexts/Ouvrage", | |
"@id": "/ouvrages/01872fd0-b4cb-7878-ade7-f7d7e3675f25", | |
"@type": "https://schema.org/Book", | |
"id": "01872fd0-b4cb-7878-ade7-f7d7e3675f25", | |
"isbn": "9783498002589", | |
"title": "L'anomalie", | |
"author": "Hervé Le Tellier" | |
} | |
``` | |
### Obtenir un ouvrage [GET] | |
Obtenir un ouvrage spécifique | |
+ Response 200 | |
[Ouvrage][] | |
## Token [/token] | |
Connection | |
### Demande un token de connexion [POST] | |
+ Request | |
```js | |
{ | |
"username": "johndoe@example.com", | |
"password": "maman" | |
} | |
``` | |
+ Response 201 (application/json) | |
```js | |
{ | |
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" | |
} | |
``` | |
## Demande de réinitialisation de mot de passe [/oubli-mot-passe] | |
Crée une demande de réinitialisation de mot de passe. | |
Un token JWT signé sera envoyé par email et utilisé dans un URL. | |
### Demande de réinitialisation [POST] | |
+ Request | |
```js | |
{ | |
"username": "johndoe@example.com" | |
} | |
``` | |
+ Response 204 | |
## Oubli de mot de passe [/oubli-mot-passe/{id}] | |
Crée une demande de réinitialisation de mot de passe. | |
Un token JWT signé sera envoyé par email et utilisé dans un URL. | |
+ Parameters | |
+ id: `01872fd0-b4cb-7878-ade7-f7d7e3675f25` (string) - UUID de la demande | |
### Réinitialisation de mot de passe [POST] | |
+ Request | |
```js | |
{ | |
"password": "dpqFJodw8fe92dqw" | |
} | |
``` | |
+ Response 204 | |
## Emprunter un ouvrage [/oubli-mot-passe/{id}] | |
Crée une demande de réinitialisation de mot de passe. | |
Un token JWT signé sera envoyé par email et utilisé dans un URL. | |
+ Parameters | |
+ id: `01872fd0-b4cb-7878-ade7-f7d7e3675f25` (string) - UUID de la demande | |
### Réinitialisation de mot de passe [POST] | |
+ Request | |
```js | |
{ | |
"password": "dpqFJodw8fe92dqw" | |
} | |
``` | |
+ Response 204 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment