Skip to content

Signal Data

TSI supports the following APIs to extract data:

1. Raw Data API (raw_data)

Gets the data for the requested signal. Gets the signal data in arrow IPC format. A maximum of 1,000 data points will be returned for each API request. Paginate the requests using next-time field present in the response headers to get more data.

2. Aggregated Data API (cells)

Gets the aggregated signal data in JSON format based on the requested aggregation level. You may get API response with data falling outside of the requested range. This is because the API response will have aggregated information in form of cells based on the aggregation duration tied to the aggregation level. The API response will have cells that contain the start and end time specified in the query.

3. Raw Points API (raw_points) - Deprecated

Gets the raw signal data in JSON format.

Get Signal Data using ID (raw_data)

Before we can get data for the signal, we need to get ths signal ID for the signal(s) of interests. While this information can be obtained from the UI under Signal Info contextual panel, programmatically, you may run a request to get signal ID using https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/signals?

Query Parameters

  • ?start= : Start time of the data request range in nanoseconds. This is a required parameter.
  • ?end= : End time of the data request range in nanoseconds. This is a required parameter only if reverse is set as true else it will be assumed as the latest available data point time of the signal.
  • ?reverse= : Set it to true to start data scan in descending order from the end time. The default value is false.

cURL request

$ curl -H "Authorization: Bearer <token>" -H "Accept: application/x-arrow-ipc" \
"<https://app3.falkonry.ai/api/1.2/data/accounts/xxxxxxxxxxxxxxx/connectedsources/yyyyyyyyyyyy/raw_data?start=1640168850582000000&end=1640168940981000000>"

Python

import io  
import requests 
import pyarrow 

URL = 'https://app3.falkonry.ai/api/1.2/data/accounts/xxxxxxxxxxxxxxx/connectedsources/yyyyyyyyyyyy/raw_data' 
TOKEN = '<token>' 
HEADERS = { 'Authorization': f'Bearer {TOKEN}', 'Accept': 'application/x-arrow-ipc' } 
PARAMS = { 'start': 1640168850582000000, 'end': 1640168940981000000 } 

req = requests.get(URL, headers=HEADERS, params=PARAMS) 
NEXT_TIME = req.headers['next-time'] # use this as start time for the next request 
stream = io.BytesIO(req.content) # read data via pyarrow 

with pyarrow.ipc.open_stream(stream) as reader: 
    df = reader.read_pandas() 
    print(df) 

Get Signal Data using Datastream ID (raw_data)

You can use this API to get data of the signal used in datastream to build the model. The signal_id is the reference ID of the signal within the context of datatstream and should always be used with entity query parameter.

Query Parameters

  • ?entity= : ID of the entity to which the signal belongs, within the datastream. This is a required parameter.
  • ?start= : Start time of the data request range in nanoseconds. This is a required parameter.
  • ?end= : End time of the data request range in nanoseconds. This is a required parameter only if reverse is set as true else it will be assumed as the latest available data point time of the signal.
  • ?reverse= : Set it to true to start data scan in descending order from the end time. The default value is false.

cURL request

$ curl -H "Authorization: Bearer <token>" -H "Accept: application/x-arrow-ipc" \
"<https://app3.falkonry.ai/api/1.2/data/accounts/xxxxxxxxxxxxxxx/datastreams/yyyyyyyyyyyy/signals/zzzzzzzzzzzzz/raw_data?start=1640168850582000000&end=1640168940981000000&reverse=true>"

Python

import io 
import requests 
import pyarrow

URL = 'https://app3.falkonry.ai/api/1.2/data/accounts/xxxxxxxxxxxxxxx/datastreams/yyyyyyyyyyyy/signals/zzzzzzzzzzzzz/raw_data'
TOKEN = '<token>'
HEADERS = {'Authorization': f'Bearer {TOKEN}', 'Accept': 'application/x-arrow-ipc'} 
PARAMS = {'start': 1640168850582000000, 'end': 1640168940981000000, 'reverse': 'true'}

req = requests.get(URL, headers=HEADERS, params=PARAMS)
NEXT_TIME = req.headers['next-time'] # use this as the end time for the next request
stream = io.BytesIO(req.content) # read data via pyarrow 

with pyarrow.ipc.open_stream(stream) as reader: 
   df = reader.read_pandas()
   print(df)

Get Data using Signal ID (cells)

Query Parameters

  • ?start_time_iso= : Start time of the requested data range in ISO format. This is a required parameter.
  • ?end_time_iso= : End time of the requested data range in ISO format. This is a required parameter.
  • ?level= : Aggregation level to use over the requested data range. This is a required parameter.
Level Aggregated duration
14 1 day
13 1 hour
12 10 minutes
11 1 minute
10 10 seconds
9 1 second
8 100 milliseconds
7 10 milliseconds
6 1 millisecond
5 100 microseconds
4 10 microseconds
3 1 microsecond
2 100 nanoseconds
1 10 nanoseconds

cURL request

$ curl -H "Authorization: Bearer <token>" \
"<https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/connectedsources/yyyyyyyyyyyy/cells?start_time_iso=2022-08-28T13:00:00.000000Z&end_time_iso=2022-08-30T16:00:00.000000Z&level=13>"

Python

import io 
import requests 
import pyarrow

URL = 'https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/connectedsources/yyyyyyyyyyyy/cells'
TOKEN = '<token>' 
HEADERS = {'Authorization': f'Bearer {TOKEN}'} 
PARAMS = { 'start_time_iso': '2022-08-28T13:00:00.000000Z', 'end_time_iso':'2022-08-30T16:00:00.000000Z', 'level': 13 }

req = requests.get(URL, headers=HEADERS, params=PARAMS)
print(req.json())

Example response

{
  "startTime": "2022-08-28T13:00:00Z",
  "endTime": "2022-08-30T16:00:00Z",
  "level": 13,
  "cellDuration": 3600000000000,
  "count": [595, 3597, 3008, null, null, ...]
  "firstpoint": ["2022-08-28T13:50:05.442000Z", "2022-08-28T14:00:00.882000Z", "2022-08-28T15:00:00.419000Z", null, null, ...],
  "max": [0.995, 0.999, 0.999, null, null, ...],
  "mean": [0.501, 0.494, 0.500, null, null, ...],
  "min": [0.001, 0.006, 0.007, null, ...],
  "std": [0.278, 0.294, 0.289, null, null ...]
}

Note

The response has min, mean, max, standard deviation values for each aggregated duration based on the requested level. The firstpoint field is the start time of the aggregated duration and count field is the number of data points present in that aggregated duration.

Get Data using Datastream ID (cells)

Query Parameters

  • ?entity= : ID of the entity to which the signal belongs, within the datastream. This is a required parameter.
  • ?start_time_iso= : Start time of the requested data range in ISO format. This is a required parameter.
  • ?end_time_iso= : End time of the requested data range in ISO format. This is a required parameter.
  • ?level= : Aggregation level to use over the requested data range. This is a required parameter.

cURL request

$ curl -H "Authorization: Bearer <token>" \
"<https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/datastreams/yyyyyyyyyyyy/signals/zzzzzzzzzzzzz/cells?entity=eeeeeeeeeeeeeee&start_time_iso=2022-08-28T13:00:00.000000Z&end_time_iso=2022-08-30T16:00:00.000000Z&level=13>"

Python

import io 
import requests 
import pyarrow

URL = 'https://app3.falkonry.ai/api/1.2/accounts/xxxxxxxxxxxxxxx/datastreams/yyyyyyyyyyyy/signals/zzzzzzzzzzzzz/cells'
TOKEN = '<token>' 
HEADERS = {'Authorization': f'Bearer {TOKEN}'} 
PARAMS = { 'entity': 'eeeeeeeeeeeeeee', 'start_time_iso': '2022-08-28T13:00:00.000000Z', 'end_time_iso': '2022-08-30T16:00:00.000000Z', 'level': 13 }
req = requests.get(URL, headers=HEADERS, params=PARAMS)
print(req.json())

Example response

{
  "startTime": "2022-08-28T13:00:00Z",
  "endTime": "2022-08-30T16:00:00Z",
  "level": 13,
  "cellDuration": 3600000000000,
  "count": [595, 3597, 3008, null, null, ...]
  "firstpoint": ["2022-08-28T13:50:05.442000Z", "2022-08-28T14:00:00.882000Z", "2022-08-28T15:00:00.419000Z", null, null, ...],
  "max": [0.995, 0.999, 0.999, null, null, ...],
  "mean": [0.501, 0.494, 0.500, null, null, ...],
  "min": [0.001, 0.006, 0.007, null, ...],
  "std": [0.278, 0.294, 0.289, null, null ...]
}

[Deprecated] Get Data using Signal ID (raw_points)

Query Parameters

  • ?start=: Start time of the data in nanoseconds. This is a required parameter.
  • ?end= : End time of the data in nanoseconds. This is a required parameter.
  • ?reverse= : Set it to true to start data scan in descending order from the start time. The default value is false.

cURL request

$ curl -H "Authorization: Bearer <token>" \
"https://app3.falkonry.ai/api/1.2/data/accounts/xxxxxxxxxxxxxxx/connectedsources/yyyyyyyyyyyy/raw_points?start=1640168850582000000&end=1640169850582000000"

Python

import requests 

URL = 'https://app3.falkonry.ai/api/1.2/data/accounts/xxxxxxxxxxxxxxx/connectedsources/yyyyyyyyyyyy/raw_points?start=1640168850582000000&end=1640169850582000000'
TOKEN = '<token>' 
HEADERS = {'Authorization': f'Bearer {TOKEN}'} req = requests.get(URL, headers=HEADERS)

print(req.json())

Example response

{
  "records": {
    "1640168850582000000": {
      "value": 2.456
    },
    "1640168850583000000": {
      "value": 3.16
    }
  },
  "metadata": {
    "length": 2,
    "next": "/api/1.2/data/accounts/xxxxxxxxxxxxxxx/connectedsources/yyyyyyyyyyyy/raw_points?start=1640168850583000001&end=1640169850582000000&reverse=False"
  }
}

[Deprecated] Get Data using Datastream ID (raw_points)

Query Parameters

  • ?entity= : ID of the entity to which the signal belongs, within the datastream. This is a required parameter.
  • ?start= : Start time of the data in nanoseconds. This is a required parameter.
  • ?end= : End time of the data in nanoseconds. This is a required parameter.
  • ?reverse= : Set it to true to start data scan in descending order from the start time. The default value is false.

cURL requests

$ curl -H \"Authorization: Bearer \<token\>\"
<https://app3.falkonry.ai/api/1.2/data/accounts/xxxxxxxxxxxxxxx/datastreams/yyyyyyyyyyyy/signals/zzzzzzzzzzzzz/raw_points?entity=eeeeeeeeeeeeeee&start=1640168850582000000&end=1640169850582000000>

Python

import requests URL =
'https://app3.falkonry.ai/api/1.2/data/accounts/xxxxxxxxxxxxxxx/datastreams/yyyyyyyyyyyy/signals/zzzzzzzzzzzzz/raw_points?entity=eeeeeeeeeeeeeee&start=1640168850582000000&end=1640169850582000000\'
TOKEN = '<token\>' 
HEADERS = {'Authorization': f'Bearer {TOKEN}'} 

response = requests.get(URL, headers=HEADERS)
print(response.json())

Example response

{
  "records": {
    "1640168850582000000": {
      "value": 2.456
    },
    "1640168850583000000": {
      "value": 3.16
    }
  },
  "metadata": {
    "length": 2,
    "next": "/api/1.2/data/accounts/xxxxxxxxxxxxxxx/datastreams/yyyyyyyyyyyy/signals/zzzzzzzzzzzzz/raw_points?entity=eeeeeeeeeeeeeee&start=1640168850583000001&end=1640169850582000000&reverse=False"
  }
}