diff --git a/docs/API.md b/docs/API.md index 654f78b87..28a6b62ca 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1049,6 +1049,81 @@ Make a request to see the json schema of system ##### 200 Success +## Sessions + +### PUT /sessions/create - creates a new session + +#### Request body + +| Parameter | Type | Description | +| --------- | ------- | ---------------------------------------------------- | +| boardId | Integer | The id of the opened board | + +```json +{ + "boardId": 123 +} +``` + + +#### Response + +##### 200 Success + +```json +{ + "token":"LCGVgzFZBTMXPfcSVuWmrqLR0j8ZG5o1PpVLeHgTHZ5+4jOJNxlzUZ6ZfPbTTpqB" +} +``` + + +### POST /sessions/sync - notifies the server, that the session is still open + +#### Request body + +| Parameter | Type | Description | +| --------- | ------- | ---------------------------------------------------- | +| boardId | Integer | The id of the opened board | +| token | String | The session token from the /sessions/create response | + +```json +{ + "boardId": 123, + "token":"LCGVgzFZBTMXPfcSVuWmrqLR0j8ZG5o1PpVLeHgTHZ5+4jOJNxlzUZ6ZfPbTTpqB" +} +``` + +#### Response + +##### 200 Success +(empty response) + +##### 404 Not Found +the provided token is invalid or expired + + +### POST /sessions/close - closes the session + +#### Request body + +| Parameter | Type | Description | +| --------- | ------- | ---------------------------------------------------- | +| boardId | Integer | The id of the opened board | +| token | String | The session token from the /sessions/create response | + +```json +{ + "boardId": 123, + "token":"LCGVgzFZBTMXPfcSVuWmrqLR0j8ZG5o1PpVLeHgTHZ5+4jOJNxlzUZ6ZfPbTTpqB" +} +``` + +#### Response + +##### 200 Success +(empty response) + + # OCS API The following endpoints are available through the Nextcloud OCS endpoint, which is available at `/ocs/v2.php/apps/deck/api/v1.0/`. diff --git a/lib/Controller/SessionController.php b/lib/Controller/SessionController.php index c42cb7b46..c273de1ac 100644 --- a/lib/Controller/SessionController.php +++ b/lib/Controller/SessionController.php @@ -73,7 +73,7 @@ class SessionController extends ApiController { $this->sessionService->syncSession($boardId, $token); return new DataResponse([]); } catch (DoesNotExistException $e) { - return new DataResponse([], 403); + return new DataResponse([], 404); } }