Skip to main content
1-Visitor
December 7, 2016
Question

How to add a dynamically created thing in a network programmatically ?

  • December 7, 2016
  • 2 replies
  • 2774 views

Hi,

I am creating a thing using code and then I want to add that thing into a network using code.Any idea how to do it ?

Thanks

2 replies

5-Regular Member
December 7, 2016

Hi Digital, could you please help me understand further on your requirement of adding to network? Which network are you referring to?

5-Regular Member
December 7, 2016

You can add your thing to the network using the AddConnection service:

    

var params = {

            from: "ParentThingName" /* STRING */,

            to: "ChildThingName" /* STRING */,

            connectionType: "Contains" /* STRING */

    };

 

        // no return

        Networks["NetworkName"].AddConnection(params);

Edit: If it is a top-level connection, leave the from parameter as undefined.

done111-VisitorAuthor
1-Visitor
December 9, 2016

Thanks James it was really helpful !