cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

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

done11
1-Newbie

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

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

3 REPLIES 3
supandey
19-Tanzanite
(To:done11)

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

jamesm1
5-Regular Member
(To:done11)

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.

done11
1-Newbie
(To:jamesm1)

Thanks James it was really helpful !

Top Tags