NetXMS Support Forum

English Support => General Support => Topic started by: cyril on May 15, 2017, 11:32:31 AM

Title: How to create DCI using NetXMS Java API version 2.1-M3
Post by: cyril on May 15, 2017, 11:32:31 AM
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?
Title: Re: How to create DCI using NetXMS Java API version 2.1-M3
Post by: Victor Kirhenshtein on May 15, 2017, 10:22:14 PM
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
Title: Re: How to create DCI using NetXMS Java API version 2.1-M3
Post by: cyril on May 16, 2017, 12:50:55 PM
Thank you, Victor!