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 the Community Ranking System, a fun gamification element of the PTC Community. X

Creating thing hierarchy in Network using Postman

SO_9699370
10-Marble

Creating thing hierarchy in Network using Postman

Hi All, 

 

I am using Postman (calling RESt API) to create things and network. I was successful in doing so. Now I am trying to build the hierarchy in the network for the things that are created.

I have used API key for authentication, and in the body tab I am using POST and providing the below URL where TestNetwork is my network  -

http://XXX.XXX.XXX.XXX:8080/Thingworx/Networks/TestNetwork/Services/AddConnection

 

I have selected "raw" in the radio button type as JSON 

I have used the below code -

 

{ "from" : "SomeTestThing", "to" : "SomeTestThing1" , "connectionType" : "Contains" }

 

But I got error 500 - internal server error 

 

I also tried with Javascript

var params = {

            from: "SomeTestThing" ,

            to: "SomeTestThing1" ,

            connectionType: "Contains" 

    };

 

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

 

got an error 403. 

 

Can you please help me where am I going wrong? I am suspecting the URL but don't know what's the correct way. 

 

Thanks In Advance

Swaraj

 

 

 

Kind Regards
SO
1 ACCEPTED SOLUTION

Accepted Solutions

Hello @SO_9699370,


If you want to build the hierarchy in the network for the things that are created in ThingWorx you can do that with Postman. You can use Javascript in Postman, you can try the following example:

 

NetworkThingsConnection.jpg

 

 

Hope it helps,

 

View solution in original post

4 REPLIES 4

Hello @SO_9699370 ,

 

Have you tried with the URL in the following format:

 

http://XXX.XXX.XXX.XXX:8080/Thingworx/Things/TestNetwork/Services/AddConnection

 

Hope it helps,

Your Postman request looks OK, given that there are no typos somewhere in your postman params http://localhost:8080/Thingworx/Networks/Net2/Services/AddConnection

At least, it works as expected on my side, I even copy&pasted the code from your message.

 

Very unlikely, but just in case, check the headers

Unbenannt2.JPG

 

Other than that... 500 is pretty generic error. What's there in the Application.log?

And, btw, which Thingworx version are you on?

Hello @SO_9699370,


If you want to build the hierarchy in the network for the things that are created in ThingWorx you can do that with Postman. You can use Javascript in Postman, you can try the following example:

 

NetworkThingsConnection.jpg

 

 

Hope it helps,

 

Thank you all. 

 

I truthfully have no idea why it didn't work. I tried with the same URL and same JSON structure, it worked. Anyways thanks for all your input. I am closing this case but accepting the last comment as solution. 

 

Kind Regards

Swaraj 

Kind Regards
SO
Top Tags