This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
api-workplace-fabric [2018/07/16 15:30] hari |
api-workplace-fabric [2018/07/17 11:04] (current) hari [Server to client data stream] |
||
---|---|---|---|
Line 625: | Line 625: | ||
Headers | Headers | ||
<code> | <code> | ||
+ | HTTP/1.1 401 INVALID-TOKEN | ||
+ | </code> | ||
+ | Body: none | ||
+ | |||
+ | ==== Response if city / building / floor / department does not exist ==== | ||
+ | |||
+ | Headers | ||
+ | <code> | ||
+ | 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 | ||
+ | </code> | ||
+ | |||
+ | Body: none | ||
+ | |||
+ | ==== Response for some other error / exception ==== | ||
+ | |||
+ | Headers | ||
+ | <code> | ||
+ | HTTP/1.1 500 ERROR | ||
+ | </code> | ||
+ | |||
+ | Body | ||
+ | <code> | ||
+ | This is a sample error message. | ||
+ | </code> | ||
+ | |||
+ | ===== Log out ===== | ||
+ | |||
+ | ==== Request ==== | ||
+ | |||
+ | API call | ||
+ | <code> | ||
+ | POST https://apiserver/freespace/oauth/revoke | ||
+ | </code> | ||
+ | |||
+ | Headers | ||
+ | <code> | ||
+ | Authorization: Bearer access-token-for-melania | ||
+ | </code> | ||
+ | |||
+ | Body: none | ||
+ | |||
+ | ==== What the server does between request and response ==== | ||
+ | |||
+ | 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. | ||
+ | |||
+ | ==== Response ==== | ||
+ | |||
+ | Headers | ||
+ | <code> | ||
+ | HTTP/1.1 204 DONE | ||
+ | </code> | ||
+ | |||
+ | ===== Live occupancy update ===== | ||
+ | |||
+ | ==== Connection ==== | ||
+ | |||
+ | URL | ||
+ | <code> | ||
+ | ws://apiserver:8000/live-occupancy | ||
+ | </code> | ||
+ | |||
+ | ==== Client to server data stream ==== | ||
+ | |||
+ | None | ||
+ | |||
+ | ==== Server to client data stream ==== | ||
+ | |||
+ | <code> | ||
+ | { | ||
+ | "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 | ||
+ | } | ||
+ | </code> |