Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi,
I have a requirement to get the output of a query result (infotable) in JSON or text format.
I have a parameter to pass to execute this Service.
How can I achieve this using REST APIs?
Appreciate your help with this.
TIA
Saby
Sorry, are you trying to create services via the REST API? That would be complicated. Any custom services can be accessed via REST API as a POST request. You just need to write a custom service for this. There are snippets in the service editor that help you convert from JSON to infotable and vice versa.
Here is some documentation on it: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS179012
Hope this helps!
Tori
Hi Tori,
I think you got it wrong,
I have a Service in a Database Thing. The Service requires an input parameter.
I want to get the results of the Service (which is in infotable format) using GET method.
Thanks
All of our services use the POST method in ThingWorx, with very few exceptions. There is an overview on using the ThingWorx REST API here: https://community.thingworx.com/community/developers/blog/2016/06/15/rest-api-overview-and-examples?&art_lang=en&posno=1…
I am not sure why it should matter where this service is located. What is the service doing? Where are you calling it from?