For now, check-ins are sometimes called work sessions. This has historical reasons.
List check-ins for current member
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.
- Authentication required:
- yes, additionally user must be a member
- Scope required:
- read_check_ins
- Parameters
-
- from: beginning of timeframe for searching for work sessions, required
- to: end of timeframe for searching for work sessions, required
Example
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.
List check-ins for entire space (all members)
Today's check-ins as member or admin:
GET https://:subdomain.cobot.me/api/check_ins
Check-ins for given time as member or admin:
GET https://:subdomain.cobot.me/api/work_sessions?from=<from>&to=<to>
- Authentication required:
- yes, additionally user must be a member or admin
- Scope required:
- read_check_ins
Example
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"
}]
List check-ins of team member
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.)
- Authentication required:
- yes, user must be member and in the same team as user they are querying
- Scope required:
- team
- Parameters
-
- from: beginning of timeframe for searching for check ins, required
- to: end of timeframe for searching for check ins, required
Example
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"
}
}]
List check-ins of a single member
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.
- Authentication required:
- yes, user must be an admin
- Scope required:
- read_check_ins
- Parameters
-
- from: beginning of timeframe for searching for check ins, required
- to: end of timeframe for searching for check ins, required
Example
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"}
}]
Check in
POST https://:subdomain.cobot.me/api/memberships/:membership_id/work_sessions
Checks a member in.
- Authentication required:
- yes, user must be an admin of the space or the same member as requested
- Scope required:
- write
Example
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
.
Check in with credentials
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.
- Authentication required:
- yes, additionally user must be a space admin or member. Members can only check in themselves. Members cannot register tokens.
- Scope required:
- checkin
- Rate limit
- 120 rpm
Example
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.
Token authentication
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.
- A user can have more than one token.
- Tokens have to be unique per space. Tokens that have already been registered cannot be registered for another user - doing so will check the user in but ot register the token and return a warning.
- Tokens are not supported for guest accounts.
Checking in the first time with login, password and token:
{
"login": "joe@example.com",
"password": "test",
"token": "12345"
}
Subsequent check-ins:
Sending the token as login works, too:
Responses are the same as above.
Get check-in
GET https://:subdomain/cobot.me/api/check_ins/:id
Returns the check-in for the given id.
- Authentication required:
- yes, additionally user must be a space admin
- Scope required:
- checkin
Get check-in status
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.
- Authentication required:
- yes, additionally user must be a space admin
- Scope required:
- checkin
Check out
DELETE https://:subdomain.cobot.me/api/memberships/:membership_id/check_ins/current
Checks a member out.
- Authentication required:
- yes, members can check only themselves out, space admins can check other members out
- Scope required:
- checkin
Example
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.
List check-in tokens
GET https://:subdomain.cobot.me/api/check_in_tokens
Lists the check-in tokens for all members of a space.
- Authentication required:
- yes, additionally user must be a space admin
- Scope required:
- checkin_tokens
Example
URL:
GET https://co-up.cobot.me/api/check_in_tokens
Response:
[
{
"token": "124d3a8",
"membership": {
"id": "87e630",
"name": "John"
}
}
]
Create check-in token
POST https://:subdomain.cobot.me/api/check_in_tokens
Creates a check-in token for a member of a space.
- Authentication required:
- yes, additionally user must be a space admin
- Scope required:
- checkin_tokens
Example
URL
POST https://:subdomain.cobot.me/api/check_in_tokens
Body:
{
"membership_id": "fdc00612c086d003fab5d99539153f68",
"token": "124d3a8"
}
Get check-in token
GET https://:subdomain.cobot.me/api/check_in_tokens/:token
Returns a check-in token for a member/admin of a space.
- Authentication required:
- yes, additionally user must be a space admin
- Scope required:
- checkin_tokens
Example
Request
GET https://demo.cobot.me/api/check_in_tokens/12345
Response:
{
"membership": {
"id": "fdc00612c086d003fab5d99539153f68",
"name": "Joe"
},
"token": "12345"
}
Delete check-in token
DELETE https://:subdomain.cobot.me/api/check_in_tokens/:token
Deletes a check-in token.
- Authentication required:
- yes, additionally user must be a space admin
- Scope required:
- checkin_tokens
Example
URL:
DELETE https://co-up.cobot.me/api/check_in_tokens/12345
Returns an empty 204 response.