Dynamically create, enable, and restart Things in a webservice
I am trying to create a service that pulls a list of properties from a webservice to create multiple Things of the same type. I am able to create multiple things in the webservice but cannot find a way to refer to the newly created things in the service so that I can enable and restart.
Here is the code I am trying to run:
/// Loops through a JSON object to extract properties for each thing
while (i < json_obj.devices.length)
{
var params = {
name: json_obj.devices[i].deviceId/* STRING */,
description: json_obj.devices[i].name /* STRING */,
thingTemplateName: 'XXXXXX' /* THINGTEMPLATENAME */
};
// no return
Resources["EntityServices"].CreateThing(params);
i++;
//
//Need to enable and restart newly created thing. Not sure how to reference it
}

