CoWorkr API Documentation

The CoWorkr API allows users to integrate real-time Sensor data with any custom application. Interact with the CoWorkr Cloud from anything using a HTTP request. 


Authentication

If using on the Asia servers replace us with asia in the below URLs.

A login call with curl

curl https://internal-us.coworkr.co/api/login/ -d "username=test&password=password"

or

curl https://internal-asia.coworkr.co/api/login/ -d "username=test&password=password"

Response

{ status: "success", data: {authToken: "f2KpRW7KeN9aPmjSZ", userId: fbdpsNf4oHiX79vMJ} }

You'll need to save the userId and token on the client, for subsequent authenticated requests.

Authenticated Calls

For any endpoints that require the default authentication, you must include the userId and authToken with each request under the following headers: - X-User-Id - X-Auth-Token

curl -H "X-Auth-Token: f2KpRW7KeN9aPmjSZ" -H "X-User-Id: fbdpsNf4oHiX79vMJ" https://internal-us.coworkr.co/api/workPlaces

WorkPlaces

You can query the system for the workPlaces you have access to.

Example using curl

curl -H "X-Auth-Token: f2KpRW7KeN9aPmjSZ" -H "X-User-Id: fbdpsNf4oHiX79vMJ" https://internal-us.coworkr.co/api/workPlaces

Response

{
    "_id": "WvamDKDx6KD4QZh5g",
    "name": "Old House",
    "address": "1180 N Lemon Ave, Menlo Park, CA 94025, USA",
    "group": {
      "name": "Tim' Group",
      "id": "azYf5H8QNBYSgrRHJ"
    },
    "owner": "tim",
    "formattedAddress": "1180 N Lemon Ave, Menlo Park, CA 94025, USA",
    "location": {
      "type": "Point",
      "coordinates": [
        -122.197805,
        37.437403
      ]
    },
    "timezone": "America/Adak",
    "sleep": true,
    "start": "2015-01-01T10:00:00.000Z",
    "end": "",
    "activeStartHour": "8",
    "activeEndHour": "18"
  }

FloorPlans

You can query the system for the floorPlans of a workPlace.

Example using curl

curl -H "X-Auth-Token: f2KpRW7KeN9aPmjSZ" -H "X-User-Id: fbdpsNf4oHiX79vMJ" https://internal-us.coworkr.co/api/workPlace/[workPlaceId]/floorPlans

Response

[
 {
    "_id": "T6DbbqgA9eWG9ooat",
    "name": "Test Floor",
    "photo": {
      "width": 842,
      "height": 569
    },
    "workPlaceId": "WvamDKDx6KD4QZh5g",
    "owner": "tim",
    "workPlaceName": "Old House",
    "activeHours": {
      "start": "8",
      "end": "18"
    },
    "timezone": "America/Adak"
  }
]

WorkPoint Status

You can query for the status of workPoints for a workPlace

Example using curl

curl -H "X-Auth-Token: f2KpRW7KeN9aPmjSZ" -H "X-User-Id: fbdpsNf4oHiX79vMJ" https://internal-us.coworkr.co/api/workPlace/[workPlaceId]/workPoints

Response

[
 {
    "_id": "573dd1d496f05ee153d5d0c4",
    "uuid": "B0B448C04B82",
    "name": "Table Vibration",
    "firmwareVersion": "2:73",
    "workPlaceId": "A8wBquS5vzGaCacYx",
    "workPlaceName": "Scruffholm",
    "lastConnect": "2016-08-22T01:14:32.820Z",
    "connected": true,
    "recentlyConnected": true,
    "occupied": true,
    "occupiedBy": "decay",
    "occupyReason": "VIBRATION ACTIVE BY DECAY 79 (25:0 var=11.6)",
    "rssi": -91,
    "battery": 37,
    "optical": 8.77,
    "floorPlanId": "vC6QuGrXvofEHQFGz",
    "floorPlanX": 679,
    "floorPlanY": 306,
    "floorPlanName": "Greatroom",
    "tags": {
      "type": "simplelink",
      "room": "dinning"
    },
    "notes": "Battery?"
  }
]

You can query for the status of workPoints for a floorPlan

Example using curl

curl -H "X-Auth-Token: f2KpRW7KeN9aPmjSZ" -H "X-User-Id: fbdpsNf4oHiX79vMJ" https://internal-us.coworkr.co/api/workPlace/[workPlaceId]/floorPlan/[floorPlanId]/workPoints

Response

[
 {
    "_id": "573dd1d496f05ee153d5d0c4",
    "uuid": "B0B448C04B82",
    "name": "Table Vibration",
    "firmwareVersion": "2:73",
    "workPlaceId": "A8wBquS5vzGaCacYx",
    "workPlaceName": "Scruffholm",
    "lastConnect": "2016-08-22T01:14:32.820Z",
    "connected": true,
    "recentlyConnected": true,
    "occupied": true,
    "occupiedBy": "decay",
    "occupyReason": "VIBRATION ACTIVE BY DECAY 79 (25:0 var=11.6)",
    "rssi": -91,
    "battery": 37,
    "optical": 8.77,
    "floorPlanId": "vC6QuGrXvofEHQFGz",
    "floorPlanX": 679,
    "floorPlanY": 306,
    "floorPlanName": "Greatroom",
    "tags": {
      "type": "simplelink",
      "room": "dinning"
    },
    "notes": "Battery?"
  }
]

WorkPoint Activity

You can query for the activity for a workPoint on a specific date. The date is a string that can be read by moment

Example using curl

curl -H "X-Auth-Token: f2KpRW7KeN9aPmjSZ" -H "X-User-Id: fbdpsNf4oHiX79vMJ" https://internal-us.coworkr.co/api/workPlace/[workPlaceId]/workPoint/[workPointId]/activity/date/[date]

Response

[
 {
    "_id": "573dd1d496f05ee153d5d0c4",
    "workPlaceId": "A8wBquS5vzGaCacYx",
    "floorPlanId": "vC6QuGrXvofEHQFGz",
    "workPointId" : "589a381adbea7e7a46b8c449",
    "time" : ISODate("2017-11-04T09:55:00Z"),
    "timeOffset" : 25200000,
    "uuid": "B0B448C04B82",
    "occupied": 'true'
 }
]
 

Custom App Integration </>

CoWorkr is building integrations with industry leaders, see below for examples. 

SPARK INTEGRATION EXAMPLE

SPARK INTEGRATION EXAMPLE

 
FM INTEGRATION EXAMPLE

FM INTEGRATION EXAMPLE