I wan to find externalIds of all the managed objects in the tenant
Java version: 17
c8y_backend: 1020.73.0
try {
InventoryFilter inventoryFilter = new InventoryFilter();
inventoryFilter.byFragmentType("c8y_IsDevice");
ManagedObjectCollection managedObjectsByFilter = inventoryApi.getManagedObjectsByFilter(inventoryFilter);
List<ManagedObjectRepresentation> allObjects = Lists.newArrayList(managedObjectsByFilter.get().allPages());
for(int i = 0 ; i < allObjects.size(); i++){
ManagedObjectRepresentation managedObjectRepresentation = allObjects.get(i);
String externalId = getExternalId(managedObjectRepresentation.getId().getValue());
}
public String getExternalId(String value) {
ExternalIDRepresentation externalIDRepresentation = identityApi.getExternalId(new ID(value));
return externalIDRepresentation.getExternalId();
}
But it is giving error in getting externalIds