Skip to main content
1-Visitor
April 25, 2016
Question

Data bindings with Java-programmed things

  • April 25, 2016
  • 1 reply
  • 1460 views

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.

1 reply

10-Marble
April 26, 2016

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));

fsiviero1-VisitorAuthor
1-Visitor
May 5, 2016

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 ?

10-Marble
May 6, 2016

Close, it should be

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