mirror of
https://gitlab.aliens-lyon.fr/encartes/backend.git
synced 2026-03-17 22:51:04 +01:00
Modify API.md according to the two previous changes in API (get_all_floors & PreconditionFailed
This commit is contained in:
parent
ada539e79a
commit
6ae30a1cac
67
API.md
67
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'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user