Is there a way to assign an Inventory role to the newly created device group using the API?
From the documentation I was able only to find API function for creating or updating a Inventory role, but I was not able to find example of how to add this role to a specific device group.
I was able to create a device group using the API:
POST <<url>>/inventory/managedObjects
{
"name": "TestDeviceGroup",
"type": "c8y_DeviceGroup",
"c8y_IsDeviceGroup": {}
}
And add the existing device to this group:
POST {{url}}/inventory/managedObjects/{{deviceGroupId}}/childAssets
{
"managedObject": {"id":"{{deviceId}}"}
}
After executing these commands I have a device inside of newly created device group.
Inventory Role for the current user is not set for this group by default.
How could I add an Inventory role to this group for current user, using the API?
After you created the new group with
POST {{url}}/inventory/managedObjects
you see in the response header the ID of the newly created group,
e.g. {{url}}/inventory/managedObjects/29102
With
POST {{url}}/user/{{tenant ID}}/users/{{user ID}}/roles/inventory
you can set an inventory role, e.g.:
Could you please elaborate more about the last chapter: The easiest way to find out this is to do the steps in the UI and to check in developer tools which requests are sent.
Does it mean to track user action on the UI with the c8ycli tool?
What are the actions that are needed to track requests?