Skip to main content
Usage API
Updated this week

Permissions

Task

Viewer

Editor

Stie Admin

Org Admin

Access and use Usage API

Prerequisites

  • Purchase the OpenSpace Usage API product.

Overview

The Usage API allows you to export analytics and reporting data from OpenSpace. The primary use is to track usage across large enterprises. For example, if you're using OpenSpace across many sites with many users, you’ll be able to see the volume of captures and who is engaging with the data, to get a fuller sense of the value you’re getting from OpenSpace.

Getting started

  1. Log in to OpenSpace.

  2. Select your avatar in the upper right-hand corner.

  3. Click View profile.

  4. Click Create key.

Using the analytics data

The Usage API is designed to make it as simple as possible to build reporting around your company’s adoption of OpenSpace.

You can use the API in a multitude of ways, from something as simple as getting data into a spreadsheet to something as complicated as providing data for a data warehouse.

Power BI

One of the fastest ways to start using the Usage API data is via Power BI. We created a Power BI Template file to help you get started. Simply download the template, enter your API key, and you will have an initial set of visualizations.

Video showing how to use the Power BI Template

Python

If you do not have Power BI, you can start leveraging the Usage API for free with Python code. An easy way to start using Python is in Google Colab.

Extracting Data

!pip install -U altair

import requests

import json

import pandas as pd

import pprint

import altair as alt

# Define the API endpoint

url = "https://api.us.openspace.ai/api/external/v1/reports/360-videos?size=100000&sort=videoStart%2CDESC"

# Get API Key from Secrets

from google.colab import userdata

api_key = userdata.get('api-key')

# Define headers with the API key in a custom header

headers = {

"api-key": api_key

}

# Make the GET request with headers

response = requests.get(url, headers=headers)

# Print the status code to verify authentication

print("Status Code:", response.status_code)

# Convert the output to JSON

data = response.json()

Format the Data

# Convert the 'content' list of dictionaries to a pandas DataFrame

df = pd.DataFrame(data['content'])

# Display the first few rows of the DataFrame

df.head()

Plot the Data

alt.renderers.enable('colab')

chart = alt.Chart(df

).mark_bar(

).encode(

x=alt.X('yearmonth(videoStart):O', title='Month'), # Binned by year and month

y='videoNumberOfFrames',

color='siteName',

tooltip=['videoStart', 'videoNumberOfFrames', 'siteName']

).properties(

width=800,

height=600

).interactive()

chart.display()

Continued Plot Data

# Create pivot table

pivot_table = pd.pivot_table(df, values='videoId', index='siteName', columns='week', aggfunc='count', fill_value=0)

# Import packages for heatmap

import matplotlib.pyplot as plt

import seaborn as sns

# Plot the heatmap

sns.heatmap(pivot_table, cmap='RdYlGn')

FAQ

What data can be pulled via the Usage API?

To get the most up-to-date information, visit https://api.us.openspace.ai/swagger-ui/index.html#/Reports for the list of reporting options.

If you have any additional questions please reach out to the OpenSpace Support team at support@openspace.ai.

Did this answer your question?