API-generated annotations not showing

I’m not sure if this is related to 7.0 because I just started to add annotations programmatically but they don’t show. Manually created annotations with the same tag and in a similar time window are displayed.

Automatic annotations are created via POST with bearer authentication. All annotations are listed when queried via API but only the manually created annotation with ID 31 appears in the panel:

[
  {
    "id": 29,
    "alertId": 0,
    "alertName": "",
    "dashboardId": 6,
    "panelId": 2,
    "userId": 0,
    "newState": "",
    "prevState": "",
    "created": 1589948818589,
    "updated": 1589948818589,
    "time": 1589860264,
    "timeEnd": 1589860264,
    "text": "auto 10.3 min",
    "tags": [
      "min"
    ],
    "login": "admin",
    "email": "admin@localhost",
    "avatarUrl": "/avatar/46d229b033af06a191ff2267bca9ae56",
    "data": {}
  },
  {
    "id": 30,
    "alertId": 0,
    "alertName": "",
    "dashboardId": 6,
    "panelId": 2,
    "userId": 0,
    "newState": "",
    "prevState": "",
    "created": 1589948818589,
    "updated": 1589948818589,
    "time": 1589909030,
    "timeEnd": 1589909030,
    "text": "auto 26.5 max",
    "tags": [
      "max"
    ],
    "login": "admin",
    "email": "admin@localhost",
    "avatarUrl": "/avatar/46d229b033af06a191ff2267bca9ae56",
    "data": {}
  },
  {
    "id": 31,
    "alertId": 0,
    "alertName": "",
    "dashboardId": 6,
    "panelId": 2,
    "userId": 0,
    "newState": "",
    "prevState": "",
    "created": 1589948875672,
    "updated": 1589948875672,
    "time": 1589875383888,
    "timeEnd": 1589875383888,
    "text": "manual",
    "tags": [
      "min"
    ],
    "login": "admin",
    "email": "admin@localhost",
    "avatarUrl": "/avatar/46d229b033af06a191ff2267bca9ae56",
    "data": {}
  }
]

What am I missing?

1 Like

I’m also seeing this behavior, my API created annotations are not displaying. Both for annotations that are filtered by dashboard or by tags. An example of the tag annotation is below.

{
  "id": 4,
  "alertId": 0,
  "alertName": "",
  "dashboardId": 0,
  "panelId": 0,
  "userId": 0,
  "newState": "",
  "prevState": "",
  "created": 1591055516617,
  "updated": 1591055516617,
  "time": 1591055517,
  "timeEnd": 1591055517,
  "text": "Released version 98ebeae",
  "tags": [
    "release",
    "release:product"
  ],
  "login": "",
  "email": "",
  "avatarUrl": "",
  "data": {}
}

This is the annotation JSON.

{
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": false,
        "iconColor": "#8F3BB8",
        "limit": 100,
        "name": "Releases",
        "showIn": 0,
        "tags": [
          "release:product"
        ],
        "type": "tags"
}

As far as I can tell, this happens when passing a “regular” unix timestamp instead of the number of milliseconds since epoch. I’ve only used Annotations on v7, so I’m not sure if it is a regression or not.

1 Like

Thank you for sharing that observation. I think in this case the error lies between the keyboard and the chair. The documentation states that timestamps are to entered as milliseconds. Node RED’s log view translated both flavors to proper times so it was less obvious to me.

Your remark solves the issue. Thank you again.

In addition to the above: check your timezones. My annotations are being created four hours away from when I expect (east coast US, standard time).