Historical messages

Historical messages can be used to add data to the honeystore for value items. This type of message adds data directly to the database that's responsible for logging the value items.

Historical message type is a JSON object that contains the following keys:

  • Message type
  • Message version
  • Payload

The payload is an array of JSON objects and can contain historical data for one or multiple value items with each JSON object inside the array dedicated to a single value item.

The payload array contains JSON objects with the following elements/keys:

  • k
  • v
  • overwrite

where,
'k' defines the tag/value item for which the history needs to be written,
'v' is an array of VQTs containing the actual historical values along with their timestamps and qualities defined,
'overwrite' is a True/False value that defines whether the history needs to be overwritten or not.

Note: The VQTs need to be ordered in the 'oldest to newest' timestamp order inside the 'v' array

Historical message Example


{
    "messagetype":"historical",
    "version":1,
    "payload":
    [
        {
            "k":"tag1",
            "v":
            [
                {
                    "v":25,
                    "q":192,
                    "t":"2022-09-25T20:00:00.000+00:00",                    
                },
                {
                    "v":23,
                    "q":192,
                    "t":"2022-09-25T21:00:00.000+00:00"
                }
            ],
            "overwrite":true
        },

        {
            "k":"tag2",
            "v":
            [
                {
                    "v":40,
                    "q":192,
                    "t":"2022-09-25T10:02:00.000+00:00",                    
                },
                {
                    "v":34,
                    "q":192,
                    "t":"2022-09-25T12:03:00.000+00:00"
                }
            ],
            "overwrite":true
        }
    ]
}

Mandatory Fields in message:

  • messagetype
  • payload
  • v (array field)
  • k (key)
  • v (value)
  • t (timestamp)