Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
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
Solved! Go to Solution.
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:
Hope it helps,
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
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:
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