Hi,
Is there a way to assign an Inventory role to the newly created device group using the Java SDK?
I was not able to find a way to perform this operation in the Java SDK documentation.
I was able to create a device group using the Java SDK:
ManagedObjectRepresentation mor = new ManagedObjectRepresentation();
mor.setName("deviceGroup");
mor.setType("c8y_DeviceGroup");
mor.setProperty("c8y_IsDeviceGroup", "");
mor = inventoryApi.create(mor);
Add the existing device to this group:
ManagedObject mob = inventoryApi.getManagedObjectApi(deviceGroupGID);
mob.addChildAssets(deviceGID);
How could I add the Inventory role for an user, so I could grant him access to this group?
My assumption is that there should be a way to add InventoryAssignmentRepresentation to the user, which contains managed Object (device group) and inventory roles for this representation. Unfortunately, I was not able to find a way to do this.
I have already posted a similar question regarding the API requests:
‘Assign inventory roles to device groups using the API’
Thanks,
Nikola