English
English
English
  • SWARM Documentation
  • What's new?
    • Version 2024.2
    • Version 2024.1
    • Version 2023.3
      • Update 1
  • SWARM in a nutshell
    • SWARM Perception Platform Overview
  • Quick start guide
    • P101, P401 or OP101
      • P101 - Perception Box
      • P401 - Perception Box
      • OP101AC - Outdoor Perception Box
      • OP101DC - Outdoor Perception Box
    • Virtual Perception Box
      • System requirements
      • Install VPX Agent on NVIDIA Jetson (Jetpack 4.6)
      • Install VPX Agent on NVIDIA Jetson (Jetpack 5.1.2)
      • Install VPX Agent on X86/NVIDIA Server
  • Solution areas
    • Traffic Insights
      • Set-up Traffic Counting
      • Set-up Traffic Counting with speed estimates
      • Set-up Intersection Insights
    • Parking Insights
      • Set-up Barrierless Parking
      • Set-up Barrierless Parking with ANPR
        • Set-up guide and recommendations - ANPR
      • Set-up Single Space/Multi Space Parking
        • Standard examples
    • Advanced Traffic Insights
      • Set-up Adaptive Traffic Control
      • Set-up Journey Time & Traffic Flow
        • Set-up guide - Installation
        • Technical concept
      • Set-up Queue Length Detection
    • People Entry/Exit counting
  • SWARM Control Center
    • Devices
      • Camera & Device Monitoring
      • Camera Configuration
        • Scenario Configuration
          • Models
          • Calibration support
          • Camera settings
        • Rule Engine
          • Use Case Examples for Rule Engine
      • Device Health
    • Data Analytics
      • Creation and organization of dashboards
      • Dashboard overview & Widget creation
        • Traffic Scenario
        • Parking Scenario
        • Generic Scenario
    • Data Integration
      • Data Analytics API (REST API)
      • Raw event data with Custom MQTT server
      • SCC API
    • Administration
      • Monitoring Alerts
      • License Management
      • User Management
  • Test & Performance measurements
    • Benchmarks
      • How do we measure Performance?
    • White paper for use cases
      • Traffic Counting
      • Barrierless Parking and ANRP
  • Useful knowledge
    • 🚒Troubleshooting Guidelines
    • Network Requirements
    • Browser Compatibility SCC
    • Our Object Classes
    • Number Plate Area Code
  • Guidelines
    • How to access the debug output?
    • How to use Azure IotHub as Custom Broker
    • VPX
      • Upgrade IotEdge from 1.1 to 1.4
      • Upgrade Jetpack from 4.4.1 to 4.6.0
  • Getting Support
    • Get in touch
    • FAQs
Powered by GitBook
On this page
  • API Call
  • Authentication
  • Integration example
  • Example Request
  • Extended Documentation

Was this helpful?

Export as PDF
  1. SWARM Control Center
  2. Data Integration

Data Analytics API (REST API)

Access Data Analytics widgets underlying data via API

PreviousData IntegrationNextRaw event data with Custom MQTT server

Last updated 1 year ago

Was this helpful?

For every Data Analytics widget, the underlying data can be queried via a provided . Integration to third-party applications works out fast and easy.

The REST API makes generated event data available to third-party applications, retrieved from your Data Analytics widgets.

API Call

Once you configure a widget, find the item "API call" in the side menu.

Authentication

Integration example

In the GitHub repository below you can find example code that highlights how to integrate the data into your own application. It showcases how to handle the required authentication as well as how to perform queries.

Example Request

Bicycle Counting

You can see a Data Analytics widget for bicycle counting as an example below. The respective type of widget (Traffic Counting) is selected, data is aggregated per day, split by object class and direction, and we filter for bicycles only.

API Request

The API-Call option shows the respective GET request for this data, as you can see below.

https://example.com/cubejs-api/v1/load?query=
{
   "measures":[
      "CrossingEvents.count"
   ],
   "dimensions":[
      "CrossingEvents.classification",
      "CrossingEvents.direction"
   ],
   "segments":[],
   "filters":[
      {
         "member":"CrossingEvents.streamId",
         "operator":"equals",
         "values":[
            "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
         ]
      },
      {
         "member":"CrossingEvents.classification",
         "operator":"contains",
         "values":[
            "bicycle"
         ]
      },
      {
         "member":"CrossingEvents.lineId",
         "operator":"equals",
         "values":[
            "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
         ]
      }
   ],
   "timeDimensions":[
      {
         "dimension":"CrossingEvents.timestamp",
         "granularity":"day",
         "dateRange":"This week"
      }
   ],
   "order":{}
}

API Response (shortened)

{
  "queryType": "regularQuery",
  "results": [
    {
      "query": {...},
      "data": [
        {
          "CrossingEvents.classification": "bicycle",
          "CrossingEvents.direction": "in",
          "CrossingEvents.timestamp.day": "2021-11-02T00:00:00.000",
          "CrossingEvents.timestamp": "2021-11-02T00:00:00.000",
          "CrossingEvents.count": "235"
        },
        {
          "CrossingEvents.classification": "bicycle",
          "CrossingEvents.direction": "out",
          "CrossingEvents.timestamp.day": "2021-11-02T00:00:00.000",
          "CrossingEvents.timestamp": "2021-11-02T00:00:00.000",
          "CrossingEvents.count": "234"
        },
        {
          "CrossingEvents.classification": "bicycle",
          "CrossingEvents.direction": "in",
          "CrossingEvents.timestamp.day": "2021-11-03T00:00:00.000",
          "CrossingEvents.timestamp": "2021-11-03T00:00:00.000",
          "CrossingEvents.count": "203"
        },
        {
          "CrossingEvents.classification": "bicycle",
          "CrossingEvents.direction": "out",
          "CrossingEvents.timestamp.day": "2021-11-03T00:00:00.000",
          "CrossingEvents.timestamp": "2021-11-03T00:00:00.000",
          "CrossingEvents.count": "249"
        }
      ],
      "annotation": {...}
    }
  ],
  "pivotQuery": {...}
}

Extended Documentation

The provided dialog pop up shows detailed information on how the API request for the generated data of this particular widget looks like. Copy/paste the command into a terminal and execute it. You can directly test the call within the dialog, including the response format, by clicking on "Try it out!" which does not require the usage of a terminal.

The provided access token is temporary. For a permanent integration into third-party applications, please request a permanent access token .

We strictly follow the documented by Microsoft. There are several that you can use.

The REST API is based on Cube.js. More information on the functionality of the API can be found in the .

curl
via the Support Portal
OAuth flow
client libraries
external documentation
REST API
GitHub - hal9000-swarm/analytics-integration-example: Example of integrating the Swarm data analytics APIGitHub
Logo
The "API Call" option is available for every widget
The specific API request is ready to use.
Example widget for bicycle counting