#StackBounty: #node.js #azure-timeseries-insights Cannot access Time Series Insights cold store from getEvents API

Bounty: 100

I’m finding it impossible to access any data in my TSI cold store using the getEvents API. I know the data is there though, because I can see it using the TSI Explorer.

Here’s the code:

const now = new Date()
now.setDate(now.getDate() - 10)
const end = now.toISOString()
now.setDate(now.getDate() - 5)
const start = now.toISOString()

body = {
    "getEvents": {
        "timeSeriesId": [
            "XXXXXXXX"
        ],
        "searchSpan": {
            "from": start,
            "to": end
        },
        "filter": null,
        "projectedProperties": [
            {
                "name": "event",
                "type": "String"
            }
        ]
    }
}

const url = https://XXXXXXXXX/timeseries/query?api-version=2020-07-31&storeType=coldstore
const res = await fetch(url, {
    method: 'POST',
    body: JSON.stringify(body),
    headers: {'Authorization': 'Bearer ' + await this.token()}
})
const json = await res.json()

I get an empty result. I know the code works, as if I change the dates to use the last 5 days, rather than from 10 days ago to 15 days ago, I get data.

I’ve tried storeType=coldstore and storeType=ColdStore (the azure docs use both(!)) but no change.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.