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:

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
  }
}

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