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

Invoking a service through REST API

SaranKarthick
16-Pearl

Invoking a service through REST API

Hi Developers,

 

I'm working on a scenario where a user with a reference in the composer should be able to invoke a service in a thing through URL alone.

 

http://Administrator:admin@123@localhost/Thingworx/Things/Test123/Properties/temp?Accept=application/json

 

Through the above URL i was able to fetch the JSON response of the property. But the drawback is for the first time even with the user credentials passed in the URL, i got the Thingworx User Credentials prompt window coming up. After cancelling it out and trying again with the same session i got the expected result.  

 

So is this a normal behavior or do we have any work around for it.

 

For invoking a service how to pass the input params in the same way as above.

 

The whole point is to invoke a Thingworx service from a third party server by passing the user creds in the URL.

(we would prefer the credentials being passed instead of the Application key).

 

Thanks and Regards,

Saran.

1 ACCEPTED SOLUTION

Accepted Solutions

use similar type of URL with credentials

 http://localhost/Thingworx/Things/[Thing Name]/Services/GetIdentifier?method=post&userid=Administrator&password=admin 

 

refer this article : https://www.ptc.com/en/support/article?n=CS224211

 

View solution in original post

7 REPLIES 7

use similar type of URL with credentials

 http://localhost/Thingworx/Things/[Thing Name]/Services/GetIdentifier?method=post&userid=Administrator&password=admin 

 

refer this article : https://www.ptc.com/en/support/article?n=CS224211

 

PaiChung
22-Sapphire I
(To:rosharma)

It is recommended to use the headers to pass the auth and content type etc.

vs. in the URL.

Not sure if your app/device has that capability

 

mgoel
17-Peridot
(To:PaiChung)

Hi @SaranKarthick

 

Could you please reply on this post.

 

please confirm if the issue has been resolved.

 

If yes, please mark the answer as accept as solution for the future reference. Thank you in advance.

Regards-Mohit Goel

Hi @mgoel,

 

I was trying the solutions that was give in the reference article but was not able to get the result. The article seems to be relevant for ThingWorx Platform 6.0 to 7.4. I'm currently using 8.0 version. i'll check out with 7.2 version and will respond correspondingly.

 

Regards,

saran

@SaranKarthick

 

Thank you so much for your response.

slangley
23-Emerald II
(To:mgoel)

Hi @SaranKarthick.

 

If one of the previous responses allowed you to find a solution, please mark the appropriate one as the Accepted Solution for the benefit of others who may have the same question.

 

Regards.

 

--Sharon

Top Tags