/
REST API - GET Sensor Values

REST API - GET Sensor Values

Difficulty: expert

Learning Objectives

After reading this article, you’ll be able to:

  • use GET Sensor Values API in Workplace


This page provides more information about the GET Sensor Values API, which allows you to export the sensor values that are stored in Workplace for your devices.

For more information about Workplace APIs in general (best practices on how to reach out, test, validate and troubleshoot APIs), see Rest API.

 

image-20250123-110431.png

GET Sensor Values API presents 3 fields in order to specify which data you want to retrieve: Device ID, From- and To-Date/Time fields.

This page contains some tips & tricks on how to best work with these fields.

 

From-To Date/Time fields

  • Provide specific date-time information following ISO 8601 format (for example: 2025-02-16T10:00:00+01:00) to get concrete data for that time frame

  • Fill in “latest” in the From field and leave To field empty to just get the latest value that is available in the Workplace database

This API cannot return range greater than one day, so limit the time span between From-To request to max 24 hours

 

Device ID field

In Device ID field, provide Device ID following the format “prefix|Device ID|suffix”, which refers to

  • the original source of the data (before it came into Workplace),

  • the unique device identifier as it’s known in the Workplace database and

  • the exact sensor type that you want to receive data for.

As there are many components and potential deviations in using the GET SensorValues API, make sure to test at least 1 device ID in the Workplace API Test to validate your request.

Prefix

The prefix refers to the original source of the data (before it came into Workplace):

  • for all Spacewell LoRa devices, use “tracknet” (see LoRa Sensors and Gateways | Spacewell LoRa devices)

  • for proprietary devices like Pointgrab, VergeSense, Xovis, Signify etc, use this vendor name (“pointgrab”, “vergesense”, “xovis”, “signify”)

  • for devices for which data is populated through Generic Endpoint, use Device Type ID as configured in the Custom Device Type (see Custom Device Types | General), usually preceded by “generic|”.

Device ID

The Device ID refers to the unique device identifier as it’s known in the Workplace database. In most cases, this is the Device ID that is mentioned in the Studio Device Overview (and Device Export). Yet sometimes it’s different, which is why we suggest to always check the device ID that is mentioned in the Studio Device Label URL (see Sensor Management | Device Info).

As a rule, we can state that if Studio shows a device ID that adheres to one of the next categories, then it’s best to check the URL of the device:

  • if device ID in Studio Device Overview contains pipe (|) or colon (:)

  • if the device data comes in through Generic Endpoint (see External Data Sources)

Depending on the browser, you can immediately verify the prefix+device ID to use in the GET API request with what is listed in the URL behind “https://studio.cobundu.com/…/devices/” or the browser might encode the pipe character as “%7C” and then you’ll need to work or read around it.

In this example, we’re looking at a VergeSense device, which in the Studio Device Overview (and Device Export) is listed with Device ID “spacewell|Spacewell-Arnhem|Floor 1|1.01”.

image-20250123-120822.png

This “pretty” device ID is constructed by Workplace based on the information that is provided by VergeSense. But the real device ID as it’s known by the Workplace Database is different if we check the URL in the Device Label (see Sensor Management | Device Info).

In the URL, we see that the Database Device ID is “B6B662F080F2FEA967F903B8A3D8807B”.

 

In the above screenshot, you might have noticed that the URL behind “https://studio.cobundu.com/…/devices/” reads “vergesense|B6B662F080F2FEA967F903B8A3D8807B”. This indeed is the prefix & device ID as we need them in the GET Sensor Values API.

Unfortunately, not every Browser uses the pipe character, as you can see below:

Check out Percent-encoding for more details on proper encoding of special characters.

Suffix

Use the suffix part of your request to specify for which exact sensor type you want to receive data. If you have a comfort sensor and want to fetch the data for humidity and temperature, then you will have to send 2 requests to the API: one for “prefix|Device ID|humidity” and one for “prefix|Device ID|temperature”.

Use this table to define the suffix for your request:

Sensor Type enabled in Workplace

suffix to use in SensorValues API

Sensor Type enabled in Workplace

suffix to use in SensorValues API

Temperature

temperature

CO2

co2

Humidity

humidity

VOC

voc

Light %

light-pct

Radon

radon

Pressure

pressure

Presence

pir

Headcount

headcount

Footfall (in)

in

Footfall (out)

out

Pulse

door

Battery

battery

If you’re unsure which Sensor Type is enabled in Workplace for your sensor, check Devices Overview or Devices Advanced Export (see Sensor Management | General). Also the Device Label screen provides information about the enabled sensors for this device.

 

 

 

Examples

  • Browan motion sensor is a LoRa device (see LoRa Sensors and Gateways | Spacewell LoRa devices). According to the instructions above, we need to use “tracknet” as a prefix

  • device ID according to Device Overview: “E8-E1-E1-00-01-09-27-25” → to be 100% sure, let’s check the Device Device Label URL (see Sensor Management | Device Info)

  • prefix + device ID according to URL: tracknet|E8-E1-E1-00-01-09-27-25

  • suffix: “pir” to use to check for Presence values

→ compose together to retrieve data via SensorValues API: tracknet|E8-E1-E1-00-01-09-27-25|pir

 

This confirms the following rule: For most LoRa sensors, the Devices Advanced Export is a great way to start and build up your list, as you can concatenate the “Device ID” column data with the “Channel” column data:

Result in SensorValues API for tracknet|E8-E1-E1-00-01-09-27-25|pir

  • Xovis is a proprietary device. According to the instructions above, we need to use “xovis” as a prefix

  • device ID according to Device Overview: 00:6E:02:00:C2:E8-1002 → looks fishy with the colon icons… let’s check the Device Device Label URL (see Sensor Management | Device Info)

  • prefix + device ID according to URL: xovis|006E0200C2E8-1002

  • suffix: “in” and “out” to use to check for Footfall (in) and Foutfall (out) values

→ compose together to retrieve data via SensorValues API: xovis|006E0200C2E8-1002|in and xovis|006E0200C2E8-1002|out

Result in SensorValues API for xovis|006E0200C2E8-1002|in and xovis|006E0200C2E8-1002|out

 

Troubleshooting

Check out the best practices highlighted in Rest API | How to use Workplace API

 


 

Search

Search