Feature Request: Add API Endpoint for Distinct Device Attribute Values

Add /inventory/attributes/{attribute_name}/values endpoint for retrieving unique attribute values.

Currently, to get all unique values for a specific device attribute, users must:

  1. Fetch all devices via /api/management/v1/inventory/devices

  2. Process the response client-side to extract and deduplicate values

Proposed Solution:
Add a new API endpoint: GET /api/management/v1/inventory/attributes/{attribute_name}/values

Response Example:

{
  "attribute_name": "device_type",
  "values": ["raspberry-pi", "esp32", "imx6", "beaglebone"],
  "total_count": 4
}

This would enable SELECT DISTINCT column - like queries.

Hi @martingrzzler,

Thanks for reaching out. I definitely can see the value in such an endpoint, because as you say, it reduces API calls. This is obviously not something which can be decided by you and me here on Mender Hub, but I’m forwarding it to product planning and drop a follow-up here once I know more.

Greetz,
Josef

Hi @martingrzzler,

Feedback from the backend team is that you should be able to achieve this with the endpoint documented at Mender API docs.

Greetz,
Josef

Thank you @TheYoctoJester ,

If I’m not mistaken, this endpoint only returns name, scope, and the count for each attribute but not the unique values for that attribute.

Cheers!

Martin