Last active
March 23, 2023 14:40
-
-
Save GregoireHebert/12f48a62d565c64ae1e6b52c36aef342 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// https://pastebin.com/kVeMjwjx | |
# endpoints publics | |
renouvellement de mot de passe | |
connexion | |
lister les ouvrages empruntable | |
obtenir un ouvrage précis | |
# endpoints privés (emprunteur) | |
emprunter un ouvrage | |
restituer un ouvrage | |
lister mes emprunts passés | |
exporter en csv mes emprunts passés | |
# endpoints privés (admin) | |
lister les emprunts passés d'un ou plusieurs utilisateurs | |
======== | |
GET /ouvrages | |
Accept: application/ld+json | |
400, 405, 406, 415 | |
Content-Type: application/problem+json | |
{ | |
"type": "/validation-error", | |
"title": "Your request parameters didn't validate blah blah blah.", | |
"raison": '...' | |
} | |
200 | |
Content-Type: application/ld+json | |
{ | |
'@context': '/context/Ouvrage' | |
'@type': 'hydra:collection', | |
'@id': '/ouvrages', | |
'hydra:member': [ | |
{ | |
'@id': '/ouvrages/xxx-xxxx-xxx-xxxx' | |
'titre': 'La roue du temps', | |
'auteur': 'Robert Jordan' | |
} | |
] | |
} |
This file contains hidden or 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
// https://gist.github.com/GregoireHebert | |
# endpoints publics | |
renouvellement de mot de passe | |
connexion | |
lister les ouvrages empruntable | |
obtenir un ouvrage précis | |
# endpoints privés (emprunteur) | |
emprunter un ouvrage | |
restituer un ouvrage | |
lister mes emprunts passés | |
exporter en csv mes emprunts passés | |
# endpoints privés (admin) | |
lister les emprunts passés d'un ou plusieurs utilisateurs | |
======== | |
POST /demande-mot-passe | |
Content-Type: application/json | |
Accept: application/json | |
{ | |
"identifiant": "alexis" | |
} | |
202 | |
======= | |
GET /demande-mot-passe/{token-genere} | |
Accept: text/html | |
200 | |
PUT /demande-mot-passe/{token-genere} | |
Content-Type: application/json | |
Accept: application/json | |
{ | |
"secret": "t0ps3cur3!" | |
} | |
204, 404, 400, 405, 406, 415, 422 | |
======= | |
======= | |
GET /code-acces | |
Content-Type: application/ld+json | |
Accept: application/ld+json | |
Authorization: basic username:password | |
{ | |
"identifiant": 'greg', | |
"secret": 'greg' | |
} | |
400, 405, 406, 415, 422 | |
201 | |
Content-Type: application/ld+json | |
{ | |
"clef": "aaa.bbb.ccc" | |
} | |
GET /ouvrages | |
Accept: application/ld+json | |
400, 405, 406, 415 | |
Content-Type: application/problem+json | |
{ | |
"type": "/validation-error", | |
"title": "Your request parameters didn't validate blah blah blah.", | |
"raison": '...' | |
} | |
200 | |
Content-Type: application/ld+json | |
{ | |
'@context': '/context/Ouvrage' | |
'@type': 'hydra:collection', | |
'@id': '/ouvrages', | |
'hydra:totalItems': 245000, | |
'hydra:member': [ | |
{ | |
'@id': '/ouvrages/xxx-xxxx-xxx-xxxx' | |
'@type': 'ouvrage', | |
'titre': 'La roue du temps', | |
'auteurs': [ | |
'/auteurs/Robert-Jordan' | |
], | |
'status': '/status/indisponible' | |
} | |
], | |
'hydra:view': { | |
'@type': 'partialCollectionView', | |
'@prev': '/ouvrages?page=1', | |
'@next': '/ouvrages?page=3', | |
'@first': '/ouvrages?page=1', | |
'@last': '/ouvrages?page=24599' | |
} | |
} | |
==== | |
PUT /ouvrages/xxx-xxxx-xxx-xxxx | |
Content-Type: application/ld+json | |
{ | |
'titre': 'La roue du temps', | |
'auteurs': [ | |
'https://api.bnf.fr/auteurs/Robert-Jordan', | |
'https://api.bnf.fr/auteurs/Liu-Ci-Xin' | |
], | |
'status': '/status/indisponible' | |
} | |
==== | |
GET /auteurs | |
{ | |
'@context': '/context/Auteur' | |
'@type': 'hydra:collection', | |
'@id': '/auteur', | |
'hydra:totalItems': 7, | |
'hydra:member': [ | |
{ | |
'@id': '/auteurs/xxx-xxxx-xxx-xxxx' | |
'@type': 'auteur', | |
'nom': 'Robert Jordan', | |
}, | |
{ | |
'@id': '/auteurs/www-wwww-www-wwww' | |
'@type': 'auteur', | |
'nom': 'Liu CI Xin', | |
} | |
] | |
} | |
GET /auteurs/{id} | |
==== | |
GET /ouvrages/xxx-xxxx-xxx-xxxx/exemplaires | |
200 | |
'exemplaires': [ | |
{ | |
'@id': '/ouvrages/xxx-xxxx-xxx-xxxx/exemplaires/1', | |
'@type': 'exemplaire', | |
'status': '/status/indisponible', | |
}, | |
{ | |
'@id': '/ouvrages/xxx-xxxx-xxx-xxxx/exemplaires/2', | |
'@type': 'exemplaire', | |
'status': '/status/indisponible', | |
} | |
] | |
==== | |
GET /ouvrages/xxx-xxxx-xxx-xxxx?properties[]=titre&properties[]=description | |
Accept: application/ld+json | |
400, 404, 405, 406, 415 | |
200 | |
Content-Type: application/ld+json | |
{ | |
'@context': '/context/ouvrages' | |
'@id': '/ouvrages/xxx-xxxx-xxx-xxxx' | |
'@type': 'ouvrage', | |
'titre': 'La roue du temps', | |
'nb-pages': 457, | |
'description': 'dddddd', | |
'auteurs': [ | |
'/auteurs/Robert-Jordan' | |
], | |
'status': '/status/indisponible' | |
} | |
GET /ouvrages/xxx-xxxx-xxx-xxxx | |
Accept: application/json | |
400, 404, 405, 406, 415 | |
200 | |
Content-Type: application/ld+json | |
{ | |
'titre': 'La roue du temps', | |
'auteurs': [ | |
'Robert Jordan' | |
], | |
'status': 'indisponible' | |
} | |
==== | |
POST /mon-compte/emprunts | |
Accept: application/ld+json | |
Content-Type: application/ld+json | |
Authorization: bearer xxx.xxx.xxx | |
{ | |
'ouvrage': 'IRI' | |
} | |
400, 404, 405, 406, 415 | |
201 | |
Content-Type: application/ld+json | |
{ | |
'@context': '/context/emprunt' | |
'@id': '/mon-compte/emprunts/abc-abc-abc' | |
'@type': 'emprunt', | |
'ouvrage': 'IRI', | |
'date-emprunt': 'YYYY-mm-dd' | |
'status': '/emprunts/status/emprunté' | |
} | |
PATCH /mon-compte/emprunts/abc-abc-abc | |
Content-Type: application/ld+json | |
Accept: application/ld+json | |
Authorization: bearer xxx.xxx.xxx | |
{ | |
'status': '/emprunts/status/rendu' | |
} | |
GET /mon-compte/emprunts | |
Authorization: bearer xxx.xxx.xxx | |
Accept: application/ld+json | |
Accept: text/csv | |
GET /admin/emprunts?emprunteur[]=/emprunteur/{id}&emprunteur[]=/emprunteur/{autre-id} | |
GET /admin/emprunteurs/{id}/emprunts | |
Authorization: bearer www.www.www | |
Accept: application/ld+json | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment