For now, check-ins are sometimes called work sessions. This has historical reasons.
GET https://:subdomain.cobot.me/api/work_sessions?from=<from>&to=<to>
Returns the check-ins for a given time frame and the current member.
GET https://co-up.cobot.me/api/work_sessions?from=2010-01-01 12:00:00 +0000&to=2010-01-02 12:00:00 +0000
Response:
[{ "membership": { "id": "fdc00612c086d003fab5d99539153f68", "name": "joe" }, "time_pass": {"id": "fbf709b2271e27d58686a2ea5e6d0ecc"}, "id": "479c76a975", "valid_from": "2011/07/27 08:37:00 +0000", "valid_until": "2011/07/28 03:59:59 +0000" }]
The time_pass
attribute is only present if a time was used for the check-in.
Today's check-ins as member or admin:
GET https://:subdomain.cobot.me/api/check_ins
Check-ins for given time (only as admin):
GET https://:subdomain.cobot.me/api/work_sessions?from=<from>&to=<to>
As member or admin:
GET https://co-up.cobot.me/api/check_ins
As admin:
GET https://co-up.cobot.me/api/work_sessions?from=2015-01-01 12:00:00 +0000&to=2015-01-02 12:00:00 +0000
Response:
[{ "membership": { "id": "fdc00612c086d003fab5d99539153f68", "name": "joe" }, "time_pass": {"id": "fbf709b2271e27d58686a2ea5e6d0ecc"}, "id": "479c76a975", "valid_from": "2011/07/27 08:37:00 +0000", "valid_until": "2011/07/28 03:59:59 +0000" }]
GET https://:subdomain.cobot.me/api/memberships/:membership_id/check_ins/?from=<from>&to=<to>
Returns the check-ins for a single member from the same team (Members that are paid for or paying for other member.)
GET https://co-up.cobot.me/api/memberships/0c4f75fa14924423810d6f12aeb56fbb/check_ins/?from=2010-01-01 12:00:00 +0000&to=2010-01-02 12:00:00 +
Response:
[{ id: "1", valid_from: "2015/07/27 10:37:00 +0000", valid_until: "2015/07/28 03:59:59 +0000", membership_id: "0c4f75fa14924423810d6f12aeb56fbb", membership: { id: "0c4f75fa14924423810d6f12aeb56fbb", name: "jane" } }]
GET https://:subdomain.cobot.me/api/memberships/:membership_id/check_ins/?from=<from>&to=<to>
Returns the check-ins for a single member for a given time frame.
GET https://co-up.cobot.me/api/memberships/0c4f75fa14924423810d6f12aeb56fbb/check_ins/?from=2010-01-01 12:00:00 +0000&to=2010-01-02 12:00:00 +
Response:
[{ id: "1", valid_from: "2015/07/27 10:37:00 +0000", valid_until: "2015/07/28 03:59:59 +0000", membership: { id: "0c4f75fa14924423810d6f12aeb56fbb", name: "jane" }, "time_pass": {"id": "fbf709b2271e27d58686a2ea5e6d0ecc"} }]
POST https://:subdomain.cobot.me/api/memberships/:membership_id/work_sessions
Checks a member in.
URL:
POST https://co-up.cobot.me/api/memberships/fdc00612c086d003fab5d99539153f68/work_sessions
Body: <empty>
Response:
{ "id": "479c76a975", "valid_from": "2012/10/25 10:05:24 +0000", "valid_until": "2012/10/25 23:59:59 +0000", "membership": { "id": "fdc00612c086d003fab5d99539153f68", "name": "joe" }, "time_pass": {"id": "fbf709b2271e27d58686a2ea5e6d0ecc"}, }
Returns the check-in and a 201 status on success, 422 if the check-in could not be created because the coworker was already checked in for that day or the token is unkown (validation errors are returned as JSON).
For members using time passes, Cobot will automatically choose the cheapest time pass to use. You can override this by passing a time_pass_name
parameter, either in the POST body or as query param.
You can also pass in the time of check-in (default=now) as valid_from
.
POST https://:subdomain.cobot.me/api/check_ins
Checks a member, space admin or guest in.
The purpose of this endpoint is to serve captive portals or keycard systems where users have to authenticate via a password or token.
URL:
POST https://co-up.cobot.me/api/check_ins
Body:
{ "login": "joe@example.com", "password": "test" }
The login/password can come either from a user account that is a member or admin of the space or from a guest account set up for the space.
Checks the user in and returns the check-in and a 201 code:
{ "id": "479c76a975", "valid_from": "2012/10/25 10:05:24 +0000", "valid_until": "2012/10/25 23:59:59 +0000", "membership": { "id": "fdc00612c086d003fab5d99539153f68", "name": "joe" } }
For admins and guests no id and membership_id are returned as Cobot does not track check-ins for them.
You can add a query parameter preview=true
to only simulate a check-in. In this case, the returned status will be 200 instead of 201 and no check-in will be actually created.
Returns 422 if the member could not be checked in plus an error, e.g. {"errors": {"login": "Login or password incorrect."}}
.
Other error scenarios: member is on a time pass plan but has no time passes, membership not confirmed yet.
When checking in a member who is already checked in the original check-in is returned.
In addition to password based authentication you can use this endpoint to authenticate users via a token. Captive portals can for example allow a MAC-address based authentication. To enable it you have to authenticate once via login/password, sending the token along. After that the user can check in by only sending the token.
Checking in the first time with login, password and token:
{ "login": "joe@example.com", "password": "test", "token": "12345" }
Subsequent check-ins:
{ "token": "12345" }
Sending the token as login works, too:
{ "login": "12345" }
Responses are the same as above.
GET https://:subdomain/cobot.me/api/check_ins/:id
Returns the check-in for the given id.
GET https://:subdomain/cobot.me/api/check_in?login=:email
Returns the member's currently active check-in or 404 if not checked in. You can also pass token=<token>
instead of the login.
DELETE https://:subdomain.cobot.me/api/memberships/:membership_id/check_ins/current
Checks a member out.
URL:
DELETE https://co-up.cobot.me/api/memberships/fdc00612c086d003fab5d99539153f68/check_ins/current
Response:
{ "id": "479c76a975", "valid_from": "2013/09/09 11:45:00", "valid_until": "2013/09/09 14:19:34", "membership": { "id": "fdc00612c086d003fab5d99539153f68", "name": "joe" } }
valid_until is the checkout date. Returns HTTP code 200. Returns 404 if the member is not checked in.
GET https://:subdomain.cobot.me/api/check_in_tokens
Lists the check-in tokens for all members of a space.
URL:
GET https://co-up.cobot.me/api/check_in_tokens
Response:
[ { "token": "124d3a8", "membership": { "id": "87e630", "name": "John" } } ]
POST https://:subdomain.cobot.me/api/check_in_tokens
Creates a check-in token for a member of a space.
URL
POST https://:subdomain.cobot.me/api/check_in_tokens
Body:
{ "membership_id": "fdc00612c086d003fab5d99539153f68", "token": "124d3a8" }
GET https://:subdomain.cobot.me/api/check_in_tokens/:token
Returns a check-in token for a member/admin of a space.
Request
GET https://demo.cobot.me/api/check_in_tokens/12345
Response:
{ "membership": { "id": "fdc00612c086d003fab5d99539153f68", "name": "Joe" }, "token": "12345" }
DELETE https://:subdomain.cobot.me/api/check_in_tokens/:token
Deletes a check-in token.
URL:
DELETE https://co-up.cobot.me/api/check_in_tokens/12345
Returns an empty 204 response.