2

我发现使用 getEvents API 无法访问 TSI 冷库中的任何数据。我知道数据在那里,因为我可以使用 TSI Explorer 看到它。

这是代码:

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()

我得到一个空的结果。我知道代码有效,就好像我将日期更改为使用最近 5 天,而不是从 10 天前到 15 天前,我得到了数据。

我已经尝试过storeType=coldstorestoreType=ColdStore蓝色的文档同时使用(!))但没有改变。

4

0 回答 0