@@ -103,47 +101,111 @@ Tables with allowed ressources sorted by REST methods can be found below. A quer
<table>
<tr>
<td>One</td>
<td>Two</td>
<tdcolspan="2">Ressource</td>
<tdcolspan="2">Description</td>
</tr>
<tr>
<tdcolspan="2"bgcolor="ddd">Three</td>
<td>Query</td>
<td>Value</td>
<td>Opt.</td>
<td>Description</td>
</tr>
<tr>
<tdcolspan="2">GET /help</td>
<tdcolspan="2">Return a cheatshee of possible REST API endpoints.</td>
</tr>
<tr>
<tdcolspan="4">No queries.</td>
</tr>
<tr>
<tdcolspan="2">GET /plugins</td>
<tdcolspan="2">List all loaded dcdbpusher plugins.</td>
</tr>
<tr>
<td>json</td>
<td>"true"</td>
<td> X </td>
<td>Format response as json.</td>
</tr>
<tr>
<tdcolspan="2">GET /sensors</td>
<tdcolspan="2">List all sensors of a specific plugin.</td>
</tr>
<tr>
<td>plugin</td>
<td>All plugin names.</td>
<td></td>
<td>Specify the plugin.</td>
</tr>
<tr>
<td>json</td>
<td>"true"</td>
<td> X </td>
<td>Format response as json.</td>
</tr>
<tr>
<tdcolspan="2">GET /average</td>
<tdcolspan="2">Get the average of the last readings of a sensor.</td>
</tr>
<tr>
<td>plugin</td>
<td>All plugin names.</td>
<td></td>
<td>Specify the plugin.</td>
</tr>
<tr>
<td>sensor</td>
<td>All sensor names of the plugin or the analytics manager.</td>
<td></td>
<td>Specify the sensor within the plugin.</td>
</tr>
<tr>
<td>interval</td>
<td>Number of seconds.</td>
<td> X </td>
<td>Use only readings more recent than (now - interval) for average calculation. Defaults to zero, i.e. all cached sensor readings are included in average calculation.</td>
</tr>
<tr>
<tdcolspan="2">PUT /start</td>
<tdcolspan="2">Start a plugin, i.e. its sensors start polling.</td>
</tr>
<tr>
<td>plugin</td>
<td>All plugin names.</td>
<td></td>
<td>Specify the plugin.</td>
</tr>
<tr>
<tdcolspan="2">PUT /stop</td>
<tdcolspan="2">Stop a plugin, i.e. its sensors stop polling.</td>
</tr>
<tr>
<td>plugin</td>
<td>All plugin names.</td>
<td></td>
<td>Specify the plugin.</td>
</tr>
<tr>
<tdcolspan="2">PUT /reload</td>
<tdcolspan="2">Reload a plugin's configuration (includes fresh creation of a plugin's sensors and a plugin restart).</td>
</tr>
<tr>
<td>plugin</td>
<td>All plugin names.</td>
<td></td>
<td>Specify the plugin.</td>
</tr>
</table>
| Key | Value | Explanation |
|:--- |:----- |:----------- |
| authkey | Your authentication token | The authentication token is required to verify that you are allowed to make this particular request. The authkey query must be included by every request
| json | Format replies to plugins and sensors requests as JSON instead of plain text
| interval | Time-value in [s] | Only for GET request of sensor readings average. One can (optionally) specify a custom time interval for which the average of sensor readings is calculated. By default, every sensor reading in the cache is used to calculate the average.
### Ressources for GET request <a name="ressourcesGET"></a>
| Ressource | Explanation |
|:--------- |:----------- |
| /help | Responds with a small cheatsheet which presents all currently supported ressources.
| /plugins | (Discovery) Returns a list of all currently loaded plugins.
| /[plugin]/sensors | (Discovery) Returns a list of all sensors which belong to [plugin]. To find out which plugins are available one can request the `/plugins` ressource.
| /[plugin]/[sensor]/avg | Calculates and returns the average of the last sensor readings. Can be combined with the interval query.
### Ressources for PUT request <a name="ressourcesPUT"></a>
| Ressource | Explanation |
|:--------- |:----------- |
| /[plugin]/[action] | One can request to do a action on the specified plugin. Currently supported actions are `start`, `stop` and `reload` which start or stop the polling of the sensors of the plugin respectively triggers a reload of the plugin configuration. If a configuration reload is requested, all sensors of the plugin are stopped first. Then new sensors are created and started according to the configuration.
### Examples <a name="restExamples"></a>
Two examples for HTTPS requests:
Two examples for HTTPS requests (authentication credentials not shown):
```bash
GET https://localhost:8000/sysfs/freq1/avg?authkey=myToken;interval=15
GET https://localhost:8000/average?plugin=sysfs;sensor=freq1;interval=15
```
```bash
PUT https://localhost:8000/bacnet/stop?authkey=myToken