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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

How do I export the output in JSON format?

CHASEONHO
18-Opal

How do I export the output in JSON format?

How do I export the output in JSON format?

 

We are developing the app[ANDROID APP and IOS APP] with ThingWorx.
I want to export some data from ThingWorx to JSON format.
I do not have a basic knowledge of JSON format.
How do I create a service to get data through the REST API?


Please help me..

10 REPLIES 10

You can form a url format like,

<http/https:><host:port>/Thingworx/<entity collection>/<entity>/<characteristic collection>/<characteristic>?<query parameters>

 

Also refer: http://support.ptc.com/cs/help/thingworx_hc/thingworx_6.0_hc/index.jspx?id=thingworx10&action=show

 

Thanks.

 

Thanks

If i simply specify the output format of a ThingWorx service, would you use the REST API to get the value elsewhere?
Using like following code
result =
"{" +

    "name:" + me.name + "," +

    "value:" + me.property +

"}";

I make service

image 4.png

and execute service with api

image 5.png

but result is Invalid Request.. 

what's wrong?

Output Base Type?

Output base type is JSON

image 6.png

Try to use,

var params = {
	infoTableName: undefined /* STRING */
};
// table: INFOTABLE
var table = Resources["InfoTableFunctions"].CreateInfoTable(params)
table.AddField({name: "ColNameOne", baseType: "STRING"});
table.AddField({name: "ColNameTwo", baseType: "STRING"});
table.AddRow({
ColNameOne : "NAME_DATA",
ColNameTwo : "VALUE_DATA",
});

var params = {
	table: table /* INFOTABLE */
};
// table: JSON
var result = Resources["InfoTableFunctions"].ToJSON(params);

toJSON.JPG

Thanks.

now result is showing like pictures

image 2.pngimage 3.png

and i test API following URL

image 1.png

but REST API return invalid request

request API URL isn't wrong?

It returns the ThingWorx service definition instead of JSON when attempting with the following URL:

image 2.png
Can not get value in the following general JSON form?
{
         "name": ThingName,
         "value": PropertyValue
}

Please test with Postman.

Postman test results.
I'm hopeless ...

image 9.pngimage 10.png
Why does not it print in JSON format?

 

Announcements


Top Tags