Skip to main content
Oct 28, 2020 5:00 AM UTC
Solved

Unable to execute services of any entity using Rest Api Call

Hi Team,

 

I am not getting any option of "Services" to execute the services using REST Call.

 

I am trying to execute service using both GET/POST request for below Url:-

http://localhost:8080/Thingworx/Things/ThingName/Services/<ServiceName>

 

But I am not getting any option of "Services" , that'swhy it is showing response as "Invalid Request".

 

Screenshot has been enclosed.

Please let me know how to enable Services execute option using in ThingWorx For Rest Call.

 

Thanks in advance.

Oct 28, 2020 10:51 AM UTC

Hello @ranjank,

 

If you invoke services of one ThingWorx in another ThingWorx instance , you can use "PostJSON()" of ContentLoaderFunctions resource and for getting property values you use "GetJSON()"

 

Hope it helps,

4 replies

Oct 28, 2020 8:08 AM UTC

Hello @ranjank 

 

Please refer the following article 

 

https://www.ptc.com/en/support/article/CS224211

 

Let me know if it doesn't resolve your issue.

 

Thanks

Om Dukiya

 

Oct 28, 2020 9:44 AM UTC

Hello @ranjank,

 

To enable execution of services using Rest Api, in the case of

http://localhost:8080/Thingworx/Things/ThingName/Services/<ServiceName>

a POST needs to be used in Postman.

 

To retrieve a property value you would need to use http://localhost:8080/Thingworx/Things/ThingName/Properties/PropertyName/

a GET needs to be used in Postman.

ranjankAuthor
Oct 28, 2020 9:49 AM UTC

Hi @Ciprian-Traian ,

 

So that means for getting Property value, I have to use "GetJSON()"

and for service execute, I have to use "PostJSON()" of ContentLoaderFunctions resource.

 

Please correct me If I am wrong.

Oct 28, 2020 10:51 AM UTC

Hello @ranjank,

 

If you invoke services of one ThingWorx in another ThingWorx instance , you can use "PostJSON()" of ContentLoaderFunctions resource and for getting property values you use "GetJSON()"

 

Hope it helps,