Data Sessions

The following endpoint only applies to BACE GO device

This endpoint in only applicable for BACE GO. Not sure which device you are working with? Find out here.

Whenever a BACE Go is turned on, a Data Session is created automatically in the BACE cloud. The Data Session is automatically closed when the device is turned off.

The BACE API for Data Sessions allows you to:

  • Get information about the Data Session

  • Get information about the device reporting data

  • Get all data associated with Data Session

To start getting Data Sessions data from the BACE API, you must have:

  • An active User account

  • A physical or virtual device (able to start/stop Data Session) provisioned and related to your project

  • (Optionally) a peripheral or sensor connected to your BACE device

How to get Data Sessions Data?

To retrieve data from a data session, two request are required:

  • List all Data Sessions

  • Get specific data from session

  • Download full session in CSV file

List all Data Sessions

To get list of all Data Sessions in the system available for you, you should make a GET request

GEThttps://dashboard.bace-iot.com/api/v2/data-session?sort=-star

In our example we will sort Data Sessions on start time descending, such that the latest Data Sessions that was started is in the beginning of the list.

{
      "items": [
          {
              "id_data_session": "86d70a1b-...",
              "id_group": "4c1c81ca-...",
              "id_person": null,
              "label": "BACE Go XXX 2022-03-30 14:04",
              "start": 1648641893,
              "end": 1648643067,
              "created_at": 1648641897,
              "created_by": null,
              "updated_at": 1648643384,
              "updated_by": null,
              "archived_at": null,
              "datapoint_count": 10,
              "isIngestionFinished": true,
              "isArchived": false,
              "_links": {
                  "self": {
                      "href": "https://dashboard.bace-iot.com/api/v2/data-session/view?id=86d70a1b-..."
                  },
                  "index": {
                      "href": "https://dashboard.bace-iot.com/api/v2/data-session/index"
                  }
              }
          },
          ...
      ]
      "_links": {
          "self": {
              "href": "https://dashboard.bace-iot.com/api/v2/data-session?sort=-start&page=1"
          },
          "first": {
              "href": "https://dashboard.bace-iot.com/api/v2/data-session?sort=-start&page=1"
          },
          "last": {
              "href": "https://dashboard.bace-iot.com/api/v2/data-session?sort=-start&page=274"
          },
          "next": {
              "href": "https://dashboard.bace-iot.com/api/v2/data-session?sort=-start&page=2"
          }
      },
      "_meta": {
          "totalCount": 5474,
          "pageCount": 274,
          "currentPage": 1,
          "perPage": 20
      },
      "expand": [
          "datatypes",
          "datatypesFilter",
          "creator",
          "updater",
          "physicalDevicesFilter",
          "physicalDevices",
          "fromDevice",
          "group",
          "dataIds"
      ],
      "labels": {
          "group.label": "Group",
          "person.label": "Person",
          "person.objectLink": "Person",
          "sourceDevicesString": "Source Devices",
          "datatypesString": "Datatypes",
          "ingestionStatusString": "Ingestion",
          "archivingStatusString": "Archived"
      }
    }

In the response you will get basic information about all Data Sessions. You have access to the following fields:

FieldDescription

id_data_session

UUID of the Data session

id_group

UUID of the Group device is in. To get more information use: expand=group

id_person

UUID of the Person related to the Datasession

label

Descriptive label for the datasession

start

Data session start timestamp in seconds

end

Data session end timestamp in seconds. null - if Data session is active and not stopped

created_at

Timestamp in seconds, when Data sessions record have been created

created_by

UUID of the User, who have created Data session. For Data session started from the device - null. To get more information use: expand=creator

updated_at

Timestamp in seconds, when Data sessions record have been last updated

updated_by

UUID of the User, who have last updated Data session. For Data session updated from the device - null. To get more information use: expand=updater

archived_at

Timestamp in seconds, when Data session have been archived

datapoint_count

Total datapoint count in the Data session

isIngestionFinished

Boolean describing data ingestion process

isArchived

Boolean describing, if archiving of Data session have been finished

Get data from Data Session

To get specific data associated with a Data Session. You should make a GET request from the data-downsampled endpoint, specifiying the session ID.

GET https://dashboard.bace-iot.com/api/v2/data-downsampled?filter[id_data_session]=ID_DATA_SESSION

Example response:

{
  "items": [
      {
          "id_container_data_latest": "c1dafb46-...",
          "id_group": "4c1c81ca-...",
          "datatype": 5205,
          "source_device": "6b88b4df-...",
          "timestamp_seconds": 1648641939.995,
          "min_val": 3.95,
          "max_val": 3.95,
          "avg_val": 3.95,
          "count_val": 1
      },
      {
          "id_container_data_latest": "c1dafb46-...",
          "id_group": "4c1c81ca-...",
          "datatype": 5205,
          "source_device": "6b88b4df-...",
          "timestamp_seconds": 1648642239.995,
          "min_val": 3.94,
          "max_val": 3.94,
          "avg_val": 3.94,
          "count_val": 1
      },
      ...
  ],
  "_links": {
      "self": {
          "href": "https://dashboard.bace-iot.com/api/v2/data-downsampled?filter%5Bid_data_session%5D=86d70a1b-...&page=1"
      },
      "first": {
          "href": "https://dashboard.bace-iot.com/api/v2/data-downsampled?filter%5Bid_data_session%5D=86d70a1b-...&page=1"
      },
      "last": {
          "href": "https://dashboard.bace-iot.com/api/v2/data-downsampled?filter%5Bid_data_session%5D=86d70a1b-...&page=1"
      }
  },
  "_meta": {
      "totalCount": 10,
      "pageCount": 1,
      "currentPage": 1,
      "perPage": 500
  }
}
FieldDescription

id_container_data_latest

UUID which describes combination of Group, Physical Device and Datatype

id_group

UUID of Group

datatype

Datatype of stored data

source_device

UUID of Physical Device, BACE Cloud have received data from

timestamp_seconds

Timestamp in seconds

min_val

Minimal value

max_val

Maximal value

avg_val

Average value

count_val

Count of downsampled samples

If data is downsampled, the field count_val is greater than 1. In this case, you can also request data between 2 timestamps to get data with a higher resolution, i.e. more datapoints.

More information about downsampling mechanism and how to use data-downsampled endpoint

Download data in .csv file

To download the complete Data Session in a CSV file, you should make GET request from the download-csv endpoint.

GET https://dashboard.bace-iot.com/api/v2/data-session/ID_DATA_SESSION/download-csv

Last updated