Get uuid from custom attribute

When doing API requests to Mender I would like to resolve the device uuid used for other operations like tunnel. This seems to not be available. Instead there’s only a request to get all devices.
When you have a fleet of over 1000 devices this is not efficient.

For example all devices report the real serial number with the attribute “serialno” , I would like to get the UUID from that.

Is there such a feature now, or can it be requested?

Can I start a tunnel session locally on the device? I still need the uuid, and I understand that this is only on the server and not the client. Can I request the UUID somehow locally on the device then?

Hi @emilm,

There are endpoints that allow searching for devices. I think adapting this should help you: Device Inventory API: Search by tags - #2 by kjaskiewiczz

Greets,
Josef

Thanks! I use 3.1.0 , was it introduced after that?

@emilm nope: Mender API docs

Though I don’t know right from top of my head if this is present in the OSS version, sorry.

Greets,
Josef

Thanks.

It is not tag I think. Tags are what you define yourself. I am talking about the attribute the device reports.

It is the /usr/share/mender/identity/mender-device-identity script that reports the custom attributes like it’s real serial number.

https://docs.mender.io/api/#management-api-device-inventory

hostname works but not my custom attribute serialno sent from the device even though it’s listed…

/inventory/devices?serialno=blah

I prefer to get the serialno which is always correct. Can’t always trust the hostname

Any updates on this?

Any idea about this?

Have you tried https://your-mender-instance/api/management/v1/inventory/devices?identity/serialno=12345? Was able to fetch a custom identity value I set in mender-device-identity with that

2 Likes

as I mentioned in my earlier post:
/inventory/devices?serialno=blah

I use identity/serialno= now
That worked!!!

Thank you!

2 Likes