Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
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.
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));
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 ?
Close, it should be
Http://Thingworx/Things/<thing>/Services/QueryPropertyHistory