Cookies help us deliver our services. By using our services, you agree to our use of cookies.

As admin:

GET https://:subdomain.cobot.me/api/memberships/:membership_id/time_passes/unused

As member:

GET https://:subdomain.cobot.me/api/membership/time_passes/unused

Returns a member's unused time passes.

Authentication required:
yes, additionally user must be a space admin or member
Scope required:
read_time_passes

URL:

GET https://co-up.cobot.me/api/memberships/fdc00612c086d003fab5d99539153f68/time_passes/unused

Response:

[
  {
    "id": "eaf345258a086d003fab5d99539153e79",
     "created_at": "2010/01/01 00:00:00 +0000",
     "updated_at": "2010/01/02 00:00:00 +0000",
     "expires_at": null,
     "used_at": null,
     "url": "https://some-space.cobot.me/api/time_passes/eaf345258a086d003fab5d99539153e79"
     "name": "Day Pass",
     "timespans": "9-5pm",
     "parsed_timespans": [
       {"from_hour": 9, "from_minute": 0,
        "to_hour": 17, "to_minute": 0, "weekdays: []}
     ],
    }
]
timespans/parsed_timespans

The hours the time pass is valid e.g. 9am-10:30pm or a duration e.g. 1h.

parsed_timespans can take two forms: either a set of timespans or a duration.
Timespans looks like this: [ {"from_hour": 9, "from_minute": 0, "to_hour": 17, "to_minute": 0, "weekdays: [1, 2, 3]} ].

Durations like this: [ {"duration_hours": 2, "duration_minutes": 0, "weekdays: []} ].

When weekdays is empty, the pass is valid on any day of the week. Otherwise only on those days returned. Weekdays are numbered from 1 (Monday) to 7 (Sunday), according to ISO 8601.

used_at
when the time pass was used (null if not used yet)
exires_at
time passes included per week or month expire automatically at the end of the week/month – in this case a time is returned. Is null for time passes bought by the member.
GET https://:subdomain.cobot.me/api/time_passes/unused

Returns all members' unused time passes.

Authentication required:
yes, additionally user must be a space admin
Scope required:
read_time_passes

URL:

GET https://co-up.cobot.me/api/time_passes/unused

Response:

[
  {
    "id": "eaf345258a086d003fab5d99539153e79",
    "created_at": "2010/01/01 00:00:00 +0000",
    "updated_at": "2010/01/02 00:00:00 +0000",
    "expires_at": null,
    "used_at": null,
    "url": "https://some-space.cobot.me/api/time_passes/eaf345258a086d003fab5d99539153e79"
    "name": "Day Pass",
    "timespans": "9-5pm",
    "parsed_timespans": [
      {"from_hour": 9, "from_minute": 0,
       "to_hour": 17, "to_minute": 0, "weekdays: []}
    ]
  }
]
POST https://:subdomain.cobot.me/api/memberships/:membership_id/time_passes

Creates time passes for a coworker.

Authentication required:
yes, additionally user must be a space admin
Scope required:
write_time_passes

URL:

POST https://:subdomain.cobot.me/api/memberships/fdc00612c086d003fab5d99539153f68/time_passes

Body:

{
  "no_of_passes": 3,
  "charge": "charge",
  "id": "1"
  "expires_at": "2017-10-01 12:00:00"
}

Returns an empty 201 response on success, otherwise 422 and the error as JSON.

id - the id of the time pass (which describes the types of time passes a member can buy) in the member's plan. expires_at - optional expiry time. If not set it does not expire. The charge parameter must be one of the following:

charge
the coworker will be charged for the time passes with the next invoice
dont_charge
the time passes will not appear on any invoice
paid
the time passes will appear on the next invoice but marked as already paid
GET https://:subdomain.cobot.me/api/time_passes/:id

Returns a single time pass.

Authentication required:
yes, additionally user must be a space admin
Scope required:
read_time_passes

URL:

GET https://co-up.cobot.me/api/time_passes/fbf709b2271e27d58686a2ea5e6d0ecc

Response:

{
  "id": "fbf709b2271e27d58686a2ea5e6d0ecc",
   "created_at": "2010/01/01 00:00:00 +0000",
   "updated_at": "2010/01/02 00:00:00 +0000",
   "expires_at": null,
   "used_at": null,
   "url": "https://some-space.cobot.me/api/time_passes/eaf345258a086d003fab5d99539153e79"
   "name": "Day Pass",
   "timespans": "9-5pm",
   "parsed_timespans": [
     {"from_hour": 9, "from_minute": 0,
      "to_hour": 17, "to_minute": 0, "weekdays: []}
   ]
  }
PATCH https://:subdomain.cobot.me/api/time_passes/:id
Authentication required:
yes, additionally user must be a space admin
Scope required:
write_time_passes

URL:

PATCH https://co-up.cobot.me/api/time_passes/fbf709b2271e27d58686a2ea5e6d0ecc

Body:

{
  "name": "Hour Pass",
  "timespans": "1h",
  "expires_at": "2020/01/01 14:00:00 +0000"
}

Response:

{
  "id": "fbf709b2271e27d58686a2ea5e6d0ecc",
   "created_at": "2010/01/01 00:00:00 +0000",
   "updated_at": "2017/09/10 00:00:00 +0000",
   "expires_at": "2020/01/01 14:00:00 +0000",
   "used_at": null,
   "url": "https://some-space.cobot.me/api/time_passes/eaf345258a086d003fab5d99539153e79"
   "name": "Hour Pass",
   "timespans": "1h",
   "parsed_timespans": [
     {duration_hours: 1, duration_minutes: 0, weekdays: []}
   ]
  }

Returns status 422 and an errors hash when sending invalid params.

DELETE https://:subdomain.cobot.me/api/time_passes/:time_pass_id

Deletes a time pass.

Authentication required:
yes, additionally user must be a space admin
Scope required:
write_time_passes

URL:

DELETE https://co-up.cobot.me/api/time_passes/eaf345258a086d003fab5d99539153e79

Body: <empty>

Returns an empty 204 response.

back to index