I am trying to set child device to a device in Cumulocity, using the inventory api, unfortunately without success.
I have already tried the following:
GId gid = new GId(deviceId);
ManagedObjectRepresentation deviceRepresentation = inventoryApi.get(gid);
ManagedObjectReferenceCollectionRepresentation childDevices = new ManagedObjectReferenceCollectionRepresentation();
ManagedObjectReferenceRepresentation morr = new ManagedObjectReferenceRepresentation();
morr.setManagedObject(mo);
List<ManagedObjectReferenceRepresentation> references = new ArrayList<ManagedObjectReferenceRepresentation>();
references.add(morr);
childDevices.setReferences(references);
deviceRepresentation.setChildDevices(childDevices);
deviceRepresentation.setLastUpdatedDateTime(null);
inventoryApi.update(deviceRepresentation);
There is no error thrown, but after that, when I look in the inventory, neither the device has childDevices set, neither the managed object has deviceParents set. What I am doing wrong?