From 6ae30a1cac58520dfbcec1b2a366314056410253 Mon Sep 17 00:00:00 2001 From: Kouril42 Date: Sun, 19 Feb 2023 11:41:34 +0100 Subject: [PATCH] Modify API.md according to the two previous changes in API (get_all_floors & PreconditionFailed --- API.md | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 59 insertions(+), 8 deletions(-) diff --git a/API.md b/API.md index 0a2ae37..fa78c1f 100644 --- a/API.md +++ b/API.md @@ -19,8 +19,8 @@ __Each place is a dict :__ ```json { 'id': int, //unique id - 'names' : string[] //possibly empty, - 'type': string //in {'C'(orridor), 'S'(tairs), 'E'(levator), 'R'(oom)} , + 'names' : string[], //possibly empty, + 'type': string, //in {'C'(orridor), 'S'(tairs), 'E'(levator), 'R'(oom)} , 'surface' : list of [int, int] //list of every points composing the room, projected on the floor surface } ``` @@ -30,6 +30,51 @@ __Errors :__ --------------------- +### /api/map/ +> Return every sites, buildings and floors of the DB. + +__The json will look like :__ +```json +[ + { + 'name': string, //name of Site 1 + 'id' : int, //id of Site 1 + 'buildings' : [ + { + 'name': string, //name of the first builing of Site 1 + 'id' : int, //its id + 'floors' : [ + { + 'name': string, //name of the first floor of the building + 'id' : int //its id + }, + { + 'name': string, //name of the second floor of the building + 'id' : int //its id + }, + {...} + ] + + }, + { + 'name': string, //name of the second builing of Site 1 + 'id' : int, //its id + 'floors' : [...] + }, + {...} + ] + }, + { + 'name': string, //name of Site 2 + 'id' : int, //id of Site 2 + 'buildings' : [...] + }, + {...} +] +``` + +--------------------- + ### /api/map/find_place_by_name/NAME >Return a dict representing the place with NAME. @@ -53,7 +98,7 @@ __Format of the dict :__ ```json { 'idPlace': int, - 'names': string[] // list of names for this place + 'names': string[], // list of names for this place 'users': string[] // list of users' name (professors, etc) } ``` @@ -70,9 +115,9 @@ __Each place is a dict :__ ```json { 'id': int // id of the edition, - 'mode': string // should be AddName, RemoveName, AddUser or RemoveUser - 'placeNames': string[] // list of names of the place - 'placeId': string // id of the place + 'mode': string, // should be AddName, RemoveName, AddUser or RemoveUser + 'placeNames': string[], // list of names of the place + 'placeId': string, // id of the place 'editorValue': string // the value to add or remove } ``` @@ -129,7 +174,7 @@ Return 'added' if successful. __Errors :__ - If _PLACEID_ doesn't correspond to any registered place : Return Error 404 "NotFoundHttpError". - If _PLACEID_ has many occurence in the PlaceRepository : Return Error 500 > The Database is corrupted. -- If _NAME_ is already registered as a name of place _PLACEID_ : Return Error 500 "ValueError" > It's a Warning that is not fatal (but I didn't manage to raise a warning with symfony so it's still an error) +- If _NAME_ is already registered as a name of place _PLACEID_ : Return Error 412 "PreconditionFailedHttpException" > It's a Warning that is not fatal as the DB will have the desired names after the request (but I didn't manage to raise a warning with symfony so it's still an error) --------------------- @@ -158,4 +203,10 @@ Return 'added' if successful. __Errors :__ - If _PLACEID_ doesn't correspond to any registered place : Return Error 404 "NotFoundHttpError". - If _PLACEID_ has many occurence in the PlaceRepository : Return Error 500 > The Database is corrupted. -- If _NAME_ is already registered as a username of place _PLACEID_ : Return Error 500 "ValueError" > It's a Warning that is not fatal (but I didn't manage to raise a warning with symfony so it's still an error) +- If _NAME_ is already registered as a username of place _PLACEID_ : Return Error 412 "PreconditionFailedHttpException" > It's a Warning that is not fatal as the DB will have the desired names after the request (but I didn't manage to raise a warning with symfony so it's still an error) + +--------------------- + +### /api/teapot +> To test if the API is reachable in a fun way +Return Error 418 'I'm a Teapot'