Places¶
List of places groups will go.
- POST /place/¶
Authenticated request
Create a new place. The user becomes the maintainer of the place once it is created.
Example request:
{ "name": "<place name>" }Request Headers: - Authorization – The token received in /token/.
Status Codes: - 200 –
Success, the new place id will be returned in the response
{ "status": "OK", "id": <place id> } - 404 – User not found (via token) (UserNotFoundException)
- 412 – Authorization required (AuthorizationRequiredException)
- 412 – Account not verified (AccountNotVerifiedException)
- GET /place/¶
Authenticated request
Return the list of places the user is the maintainer or belongs to one of the user’s groups.
Request Headers: - Authorization – Access token received from /token/
Status Codes: - 200 –
Success
HTTP/1.1 200 OK Content-Type: application/json { "status": "OK", "places": [ { "id": "<placeId>", "name": "<place name>", "maintainer": <true if the user is the group maintainer>}, ...] } - 404 – User not found (via token) (UserNotFoundException)
- 412 – Authorization required (AuthorizationRequiredException)
- PUT /place/(placeId)/¶
Authenticated request
Update the place information. The user must be the maintainer of the place to change any information. Partial requests are accepted and missing fields will not be changed.
Parameters: - placeId – Id for the place, as returned via GET or POST.
Example request:
{ "name": "New name", "admin": "newAdmin" }Request Headers: - Authorization – Access token received from /token/.
Status Codes: - 200 – Success
- 400 – Request must be in JSON format (RequestMustBeJSONException)
- 403 – User is not administrator of the group (UserIsNotAdminException)
- 404 – User not found (via token) (UserNotFoundException)
- 404 – New maintainer does not exist (NewMaintainerDoesNotExistException)
- 404 – Place does not exist (ElementNotFoundException)
- 412 – Authorization required (AuthorizationRequiredException)
- DELETE /place/(placeId)/¶
Authenticated request
Delete the place. The user must be the maintainer of the place to delete it.
Parameters: - placeId – The place Id, as returned by GET or POST
Header Authorization: Access token from /token/
Status Codes: - 200 – Success
- 403 – User is not the group administrator (UserIsNotAdminException)
- 404 – User not found (via token) (UserNotFoundException)
- 404 – Place does not exist (ElementNotFoundException)
- 412 – Authorization required (AuthorizationRequiredException)