How to get Events

I want to read last bootstrap, boot, inform dates using getParameterValues

query = {
“name”: “getParameterValues”,
“parameterNames”: [
“Events.0_BOOTSTRAP”
]
}

e.g. tried getting parameters through the API like
Events.0_BOOTSTRAP
_events.0_BOOTSTRAP
_events._0_BOOTSTRAP

Is there a way to retrieve these as a getParameterValues query or another interface?

Thank you.

If you are using the API, the data will be returned in the payload. If you are using a provision script, then in a declare.

With the API, you can also do a projection so you only return the data that you need. This is useful if you only care about a few pieces of data. curl -i 'http://localhost:7557/devices?query=%7B%22_id%22%3A%22202BC1-BM632w-000000%22%7D&projection=Events.0_BOOTSTRAP,Events.1_BOOT,_lastInform' This will give you the last bootstrap, last boot, and last inform.

In a provision script, you would do it like this:

const lastBootstrap = declare('Events.0_BOOTSTRAP', {value: 1}).value[0];
const lastBoot = declare('Events.1_BOOT', {value: 1}).value[0];
const lastInform = declare('Events.Inform', {value: 1}).value[0];

1 Like

Thank you. It was the API I was using (and it has been a while since I used it). I was using the wrong method (task vs query).

My query now is like yours: The path (without host) is:

"/devices?query=%7B%22_id%22%3A%22104738-XS%252D2426G%252DA-ALCLFC00FF91%22%7D&projection=Events.0_BOOTSTRAP,Events.1_BOOT,_lastInform"

I do get the _lastInform time but not the Events.0_BOOTSTRAP,Events.1_BOOT.
[
{“_id”:“104738-XS%2D2426G%2DA-ALCLFC00FF91”,“_lastInform”:“2022-08-29T15:50:42.660Z”}
]

I am using latest version, npm install. Here is what the device page shows.

Try these:
_lastInform,_lastBootstrap,_lastBoot,_registered

Thank you very much, those worked.
Regards,
Mark.