API call
POST https://apiserver/freespace/users
Body
{ "name": "Melania Carmella", "email": "m.carmella@ramseytech.co.uk" }
Headers
HTTP/1.1 201 USER-CREATED
Body: None
Headers
HTTP/1.1 409 USER-EXISTS
Body: None
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
This is an example error message
This particular URL is not an API call done via AJAX, but it appears inside the body of the confirmation email after he registers. Naturally, clicking on the link inside the email will trigger this script to execute.
URL
https://apiserver/freeserver/actions/confirm?token=token-generated-for-melania's-confirmation
Headers
HTTP/1.1 302 VALID-TOKEN Location: https://apiserver/freeserver/set-password.html?userid=primary-key-for-melania&token=a-uuid-provisional-token-to-set-password
Body: None
Headers
HTTP/1.1 307 INVALID-TOKEN Location: https://apiserver/freespace/invalid-confirmation-token.html
Body: None
Headers
HTTP/1.1 500 ERROR Location: https://apiserver/freespace/unexpected-error.html
API call
PATCH https://apiserver/freespace/users/melania's-user-id
Headers
Content-Type: application/json Authorization: Bearer provisional-token-for-melania
Body
{ password: melania's-new-password }
Headers
HTTP/1.1 204 DONE
Body: None
Headers
HTTP/1.1 404 USER-NOT-FOUND
Body: None
Headers
HTTP/1.1 401 INVALID-TOKEN
Body: None </code>
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
This is a sample error message
API call
POST https://apiserver/freespace/oauth/token
Headers
Content-Type: application/json Authorization: Basic meliania's-username-and-password-in-base64
Please note that in Basic authorization mechanism, the username and password are appended with a colon (:) in between. This string is then converted to Base64 encoding.
For instance, let's assume that Melania's password is m3l@n1@.
First, we'd form a string combining the username, colon and password, i.e. m.carmella@ramseytech.co.uk:m3l@n1@
This string is then converted into Base64, which would be bS5jYXJtZWxsYUByYW1zZXl0ZWNoLmNvLnVrOm0zbEBuMUA=. This strange-looking string is what is sent in the Authorization header after the world Basic.
Body
{ "grant_type": "client_credentials", "scope": "all:all" }
Headers
HTTP/1.1 200 OK Content-Type: application/json
Body
{ "access_token": "access-token-for-melania", "token_type": "bearer", "scope": "all:all" }
HTTP/1.1 404 USER-NOT-FOUND
Body: None
HTTP/1.1 401 INVALID-PASSWORD
Body: None
API call
https://apiserver/freespace/recovery-requests
Headers
Content-Type: application/json
Body
{ "email": "m.carmella@ramseytech.co.uk" }
Headers
HTTP/1.1 204 DONE
Body: None
There is no body in the response, but an email is sent with the recovery URL.
Headers
HTTP/1.1 404 USER-NOT-FOUND
Body: None
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
This is a sample error message.
API call
GET https://apiserver/freespace/users/me
Headers
Authorization: Bearer access-token-of-the-user
Body: none
Headers
Content-Type: application/json
Body
{ "id": "melania's-uuid-user-id" "name": "Melania Carmella", "email": "m.carmella@ramseytech.co.uk", "phone": "+44 20 7946 0292", "city": { "id": "uuid-based-city-id-for-london", "name": "London" }, "preferredBuilding": { "id": "uuid-based-building-id-for-high-holborn", "name": "High Holborn" }, "preferredFloor": { "id": "uuid-based-floor-id-for-first-floor-of-high-holborn", "name": "1st" }, "preferredDepartment": { "id": "uuid-based-dept-id-for-r&d-1st-floor-high-holborn", "name": "Research and Development" } }
Headers
HTTP/1.1 401 INVALID-TOKEN
Body: none
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
This is a sample error message.
API call
GET https://apiserver/freespace/cities/<city-id>/spaces
Headers
Authorization: Bearer access-token-for-the-user
Headers
HTTP/1.1 200 OK Content-Type: application/json
Body:
[ { "id": "uuid-of-the-building", "name": "Willis Towers", "address": "22, Lewis Street, London", "floors": [ { "id": "uuid-of-the-floor", "name": "1st", "spaces": [ { "id": "uuid-of-the-space", "name": "Task desk", "available": 32 }, ... more spaces.. ] }, ... more floors ... ] }, ... more buildings ... ]
Header
HTTP/1.1 401 INVALID-TOKEN
Body: none
Header
HTTP/1.1 404 CITY-NOT-FOUND
Body: none
Header
HTTP/1.1 204 NONE
Body: none
Header
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
This is a sample error message.
API call
GET https://apiserver/freespace/buildings/uuid-for-building/floors/uuid-for-floor/floor-map
Headers
Authorization: Bearer access-token-of-user
Headers
HTTP/1.1 200 OK Content-Type: application/json
Body
{ "id": "uuid-of-the-floor", "schematic": "https://path/to/schematic/diagram/image.png-or-jpg", "departments": [ { "id": "uuid-of-the-department", "name": "Information Technology", "x": X co-ordinate of the centre of the department, "y": Y co-ordinate of the centre of the department, }, ... more departments ... ], "spaces": [ { "id": "uuid-of-the-individual-space", "categoryId": "uuid-of-the-space-category", "x": X co-ordinate of the workspace, "y": Y co-ordinate of the workspace, } ... more spaces ... ] }
Headers
HTTP/1.1 401 INVALID-TOKEN
Body: none
Headers
HTTP/1.1 404 BUILDING-NOT-FOUND
Body: none
Headers
HTTP/1.1 404 FLOOR-NOT-FOUND
Body: none
Headers
HTTP/1.1 500 ERROR Content-Type: text/plain
Body
This is a sample error message.
API call
PATCH https://apiserver/freespace/users/me
Headers
Authorization: Bearer <access-token-for-melania> Content-Type: application/json
Body
{ "phone": "phone-number", "city": "city-uuid-of-executive's-city", "preferredBuildingId": "uuid-of-preferred-building", "preferredFloor": "uuid-of-preferredFloor", "preferredDepartment": "uuid-of-preferred-department" }
Headers
HTTP/1.1 204 DONE
Body: none
Headers
HTTP/1.1 401 INVALID-TOKEN
Body: none
Headers
HTTP/1.1 404 CITY-NOT-FOUND or HTTP/1.1 404 BUILDING-NOT-FOUND or HTTP/1.1 404 FLOOR-NOT-FOUND or HTTP/1.1 404 DEPARTMENT-NOT-FOUND
Body: none
Headers
HTTP/1.1 500 ERROR
Body
This is a sample error message.
API call
POST https://apiserver/freespace/oauth/revoke
Headers
Authorization: Bearer access-token-for-melania
Body: none
The server looks up the bearer token in the database and deletes it, so that the token is invalid from the next time and the user is always redirected to the login page. The response always leads to a 204 response.
Headers
HTTP/1.1 204 DONE
URL
ws://apiserver:8000/live-occupancy
None
{ "spaceId": "uuid-of-the-room/space-that-is-occupied-or-released", "departmentId": "uuid-of-the-department-where-the-space-is", "floorId": "uuid-of-the-floor-where-the-space-is", "buildingId": "uuid-of-the-building-where-the-space-is", "isOccupied": true if occupied, false if release }