Skip to main content
1-Visitor
October 29, 2018
Solved

Invoking a service through REST API

  • October 29, 2018
  • 2 replies
  • 4729 views

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.

Best answer by rosharma

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

 

2 replies

1-Visitor
October 29, 2018
rosharma16-PearlAnswer
16-Pearl
November 1, 2018

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

 

22-Sapphire I
November 1, 2018

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

 

5-Regular Member
November 13, 2018

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