Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hello,
I want to create get API in Thingworx from service with converting data table format into json format? for this I create one query for getting all data and use tojson() snippets ..... set output as json base type, but I'm getting output in info table. I also used getjson() snippets and getting blank headers output please refer below attachments and suggest :
How to create get API in Thingworx with getting all data in Json format ?
Thanks in Advance
tojson()snippets output:
getjson()snippets output:
Solved! Go to Solution.
If you take your content as an infotable and assign it to a property
then when you do a get with 'accept-type' as application/json you should get that infotable as a json.
A GET would only work if you are reading some in memory information.
So if you set the value on a Property you should be able to retrieve that with a GET
Thanks for giving response, Yes I want to retrieve data from PostgreSQL Database and want to convert table format data into JSON format .for this ,I tried below query in PostgreSQL when when I set output as JSON base type it gave me no result but when I set output as Infotable base type gave me table format JSON data and I want in proper JSON format Data so please refer below attachment and suggest :
How do I covert table format data into proper JSON format data ??
select row_to_json("tbl_machine") as json from "tbl_machine"
Output Getting :
Postman Output :
Expected Output :
If you take your content as an infotable and assign it to a property
then when you do a get with 'accept-type' as application/json you should get that infotable as a json.
Thanks for your reply ,It works.
Hi,I have one more que. I have Number of tables so shall I create number of infotable property ??
Is there any way to get continuous data when I trigger any API ??
Hi @RM12.
For your first question, we're not clear on what you're asking.
For continuous data, since we're assuming you're calling it from outside the platform, you may be able to set something up to run on a scheduled basis.
Please provide more information and we'll try to be more specific.
Regards.
--Sharon