-
Notifications
You must be signed in to change notification settings - Fork 50
REST Persistence
NolanGarrett edited this page Dec 9, 2016
·
9 revisions
The persistence RESTful interface used in HABmin is defined below. It is used to get information on persistence services, items and data.
- GET to /rest/persistence will list all persistence services registered with openHAB and all items that are configured for persistence on all services. The format for this call is not shown here, but is the same as performing a call to the next two services separately.
- GET to /rest/persistence/services will list all persistence services currently registered with openHAB
- GET to /rest/persistence/items will list all items that have persistence configured with any currently registered persistence service
- GET to /rest/persistence/servicename/itemname will provide data for the specified item, from the specified persistence service. Parameters are -:
- starttime
- endtime
- page
- pagelength
For the above, times can be provided in one of two formats.
- Java/Javascript long time - the number of milliseconds since Jan 01 1970
- A string in the format YYYY-MM-YY-HH-MM-SS
A call to GET to /rest/persistence/services will return the following
<persistence>
<services>
<name>mysql</name>
<actions>Create</actions>
<actions>Read</actions>
<actions>Update</actions>
<actions>Delete</actions>
</services>
</persistence>
A call to GET to /rest/persistence/items will return the following
<persistence>
<items>
<name>Temperature_GF_Corridor</name>
<type>NumberItem</type>
<icon>temperature</icon>
<label>Temperature</label>
<units>°C</units>
<format>%.1f</format>
<groups>Temperature</groups>
<groups>GF_Corridor</groups>
<services>rrd4j</services>
<services>db4o</services>
<services>mysql</services>
</items>
<items>
<type>NumberItem</type>
<name>LoungeThermostat_RoomTemp</name>
<icon>temperature</icon>
<label>Lounge Heating Temperature</label>
<groups>Heating</groups>
<groups>Temperature</groups>
<services>mysql</services>
</items>
A call to GET to /rest/persistence/servicename/itemname will return the following
<history>
<type>NumberItem</type>
<name>Temperature_Boiler</name>
<statemax>57.0625</statemax>
<timemax>1380727703000</timemax>
<statemin>18.8125</statemin>
<timemin>1380718960000</timemin>
<stateavg>48.29706101190476</stateavg>
<datapoints>1344</datapoints>
<data>
<time>1380718950000</time>
<state>18.875</state>
</data>
<data>
<time>1380718960000</time>
<state>18.8125</state>
</data>
Same output format are supported as offered by the REST API: XML, JSON, and JSONP. Access them via GET parameter type
: "?type=xml", "?type=json" or "?type=jsonp
The actual REST path may not be as described above. In testing on 0.1.4-snapshot, the URLs take the form of http://OpenHAB IP:OpenHAB Port/services/habmin/persistence/services.
- Home
- General Configuration
- Item Configuration
- Sitemap Configuration
- Binding Configuration
- Charting
- Persistence stores and graphing
- Rules and Automation
- Rule Designer: Overview
- Rule Designer: Building Blocks
- Rule Designer: Example 1
- Rule Designer: Example 2
- Rule Text Editor
- Technical
- Language Support
- Binding descriptor files
- Z Wave Product Database
- REST Item Config
- REST Item Icons
- REST Persistence
- REST Sitemap Config
- Rule Item Library
- Item Rule Configuration