Finding the last deployment for a group using REST API

Hi everyone,

I am using a production server (v 2.6.1) and I am trying to automise some steps when it comes to accepting devices or creating deployments using the API.

In this context, when I add a new device to a group, I would like to be able to automatically create a new deployment on that group (with the group’s latest update), so that the new device runs the same version as the other devices on the group. My question is, is there a way to find out the last deployment for a specific group or device using the REST API? I’ve search through the documentation, but I didn’t manage to find this information.

Thank you very much!

Hi @teonaseverin,

You can use devices endpoint defined here: Mender API docs

For example, you can filter it by:

${MENDER-URL}/api/management/v1/inventory/devices?group=cool-group-name

Look at group=name above

And the value in the response you are looking for is:

   { "name": "artifact_name",
    "value": "release-1", «-- This value
    "scope": "inventory"}

Please let me know if this is useful for you :slight_smile:

Luis