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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Data bindings with Java-programmed things

fsiviero
1-Newbie

Data bindings with Java-programmed things

Hi,

We are building an Extension and would like to see snippets or examples of the data bindings required for the Extension to get, for example, historic information of one data item.

3 REPLIES 3
danme
5-Regular Member
(To:fsiviero)

Hi Fransisco,

In order to access property history you will need to have set up a stream or a value stream on your thing itself from the platform end. This will happen after you create a thing based on your extension thing template. Assuming this is set up properly, you can then execute the following command to get the property history:

General property search:

thingName.QueryPropertyHistory(maxItems(double), startDate(Datetime), endDate(Datetime), oldestFirst(Boolean), query(JSON));

if you want to get a specific property, then you can use  more narrow search:

ex.

thingName.QueryStringPropertyHistory(maxItems(double), propertyName(String), startDate(Datetime), endDate(Datetime), oldestFirst(Boolean), query(JSON));


or


thingName.QueryBooleanPropertyHistory(maxItems(double), propertyName(Boolean), startDate(Datetime), endDate(Datetime), oldestFirst(Boolean), query(JSON));

fsiviero
1-Newbie
(To:danme)

Thank you for your answer. How would I access the same data from the REST API instead? Would it be something like: http://localhost/Thingworx/Things/<thing>/QueryPropertyHistory ?

danme
5-Regular Member
(To:fsiviero)

Close, it should be

Http://Thingworx/Things/<thing>/Services/QueryPropertyHistory

Top Tags