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

Invoking a service through REST API

SOLVED
Highlighted

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

Re: Invoking a service through REST API

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

 

7 REPLIES

Re: Invoking a service through REST API

Re: Invoking a service through REST API

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

 

Re: Invoking a service through REST API

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

 

Re: Invoking a service through REST API

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

Re: Invoking a service through REST API

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

Re: Invoking a service through REST API

@SaranKarthick

 

Thank you so much for your response.

Re: Invoking a service through REST API

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