What product/components do you use and which version/fix level are you on?
Cumulocity IOT
Is your question related to the free trial, or to a production (customer) instance?
customer
What are you trying to achieve? Please describe it in detail.
I am getting the managedobjectfilter like below. I want to get all the device’s managedobjects
I know there is an option to get all the pages and iterate through the pages.
InventoryFilter inventoryFilter = new InventoryFilter(); inventoryFilter.byFragmentType(IsDevice.class);
ManagedObjectCollection managedObjectsByFilter = inventoryApi.getManagedObjectsByFilter(inventoryFilter); List allObjects = Lists.newArrayList(managedObjectsByFilter.get(2000).allPages());
How to use the managedObjectsByFilter.getNextPage(BaseCollectionRepresentation)
In this case how to instantiate BaseCollectionRepresentation? I tried like below and passed the baseCollectionRep inside getNextPage(). But am getting null in that case. I want to get all the available pages or anything more than 2000.
BaseCollectionRepresentation baseCollectionRep = new ManagedObjectCollectionRepresentation();
Kindly help.
Do you get any error messages? Please provide a full error message screenshot and log file.
Have you installed all the latest fixes for the products and systems you are using?
Iterator<ManagedObjectRepresentation> deviceIt = inventoryApi.getManagedObjects().get().allPages().iterator();
while (deviceIt.hasNext()) {
ManagedObjectRepresentation mor = deviceIt.next();
}
Btw. setting the max page size of 2000 is not always a good thing as the requests per page might take very long to retrieve all objects. Keeping it the default page size might be more efficient when not all managed objects should be processed but only some with a certain condition.