How to create DCI using NetXMS Java API version 2.1-M3

Started by cyril, May 15, 2017, 11:32:31 AM

Previous topic - Next topic

cyril

Prior 2.1-M3, It was possible to create Data Collection Item in nxshell like this:

template_id = session.findObjectByName("Some_template").getObjectId()
config = session.openDataCollectionConfiguration(template_id)
DCIid = config.createItem()
DCI = template_config.findItem(DCIid)


Now, createItem method requires DataCollectionObject instance. Moreover, DataCollectionObject constructor is protected and requires an id parameter.
How can I create DCI using this method or what is the right way to create DCI in template using nxshell?

Victor Kirhenshtein

Hi,

DataCollectionObject is a base class for DataCollectionItem and DataCollectionTable. You should create new DataCollectionItem object and pass it to createItem. Pass 0 is ID for new DCI.

Best regards,
Victor