Hi there,
I want to add a new Device to a specific Asset/Group. Is that directly possible in the creation process of a new device?
I figured out, that I have to do a request to {{baseUrl}}/inventory/managedObjects/:id/childAssets .
That worked just fine, but as I’m using the java sdk for my microservice, I run into a few problems.
I came up with this code
List<ManagedObjectReferenceRepresentation> assetCollection = deviceObjectRepresentation.getAssetParents().getReferences();
ManagedObjectReferenceRepresentation groupAssetRepresentation = new ManagedObjectReferenceRepresentation();
groupAssetRepresentation.set(inventoryApi.get(new GId("117063791")));
assetCollection.add(groupAssetRepresentation);
deviceObjectRepresentation.getAssetParents().setReferences(assetCollection);
deviceObjectRepresentation.setLastUpdatedDateTime(null);
inventoryApi.update(deviceObjectRepresentation);
to update the parentAssets of the deviceObjectRepresentation.
If I print out the deviceObjectRepresentation it seemed to work, but when looking at the result on cumulocity, nothing has changed.
I don’t think it has something to do with the permissions, because that should result in a 403, as I suppose.
I didn’t get any errors by running the code.
Thanks for any possible help