sensors is separate API with td
This commit is contained in:
@@ -18,7 +18,8 @@
|
||||
<h1>Sensor Readouts — API Documentation</h1>
|
||||
|
||||
<h2>Base URL</h2>
|
||||
<p><code>http://localhost:5000/api</code></p>
|
||||
<p><code>{{ main_api_url }}</code></p>
|
||||
<p>The main app proxies all requests to the sensors API service.</p>
|
||||
|
||||
<!-- GET /api/sensors -->
|
||||
<h2>GET /api/sensors</h2>
|
||||
@@ -26,7 +27,7 @@
|
||||
<span class="method get">GET</span><span class="path">/api/sensors</span>
|
||||
<p class="desc">Return a list of all sensors ordered by name.</p>
|
||||
<p class="section-label">curl</p>
|
||||
<pre><code>curl http://localhost:5000/api/sensors</code></pre>
|
||||
<pre><code>curl {{ main_api_url }}/sensors</code></pre>
|
||||
<p class="section-label">Response 200</p>
|
||||
<pre><code>[
|
||||
{ "id": 1, "name": "outdoor-station" },
|
||||
@@ -39,7 +40,7 @@
|
||||
<span class="method post">POST</span><span class="path">/api/sensors</span>
|
||||
<p class="desc">Create a new sensor.</p>
|
||||
<p class="section-label">curl</p>
|
||||
<pre><code>curl -X POST http://localhost:5000/api/sensors \
|
||||
<pre><code>curl -X POST {{ main_api_url }}/sensors \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"name": "new-sensor"}'</code></pre>
|
||||
<p class="section-label">Response 201</p>
|
||||
@@ -58,7 +59,7 @@
|
||||
<span class="method get">GET</span><span class="path">/api/sensors/:id/types</span>
|
||||
<p class="desc">Return distinct readout types available for a given sensor.</p>
|
||||
<p class="section-label">curl</p>
|
||||
<pre><code>curl http://localhost:5000/api/sensors/1/types</code></pre>
|
||||
<pre><code>curl {{ main_api_url }}/sensors/1/types</code></pre>
|
||||
<p class="section-label">Response 200</p>
|
||||
<pre><code>["humidity", "pressure", "temperature"]</code></pre>
|
||||
<p><strong>Errors:</strong></p>
|
||||
@@ -80,10 +81,10 @@
|
||||
</table>
|
||||
<p class="section-label">curl</p>
|
||||
<pre><code># all types
|
||||
curl http://localhost:5000/api/sensors/1/readouts
|
||||
curl {{ main_api_url }}/sensors/1/readouts
|
||||
|
||||
# filter by type
|
||||
curl "http://localhost:5000/api/sensors/1/readouts?type=temperature"</code></pre>
|
||||
curl "{{ main_api_url }}/sensors/1/readouts?type=temperature"</code></pre>
|
||||
<p class="section-label">Response 200</p>
|
||||
<pre><code>[
|
||||
{ "value": 24.31, "timestamp": "2026-09-11T10:30:00" },
|
||||
@@ -96,7 +97,7 @@ curl "http://localhost:5000/api/sensors/1/readouts?type=temperature"</code></pre
|
||||
<span class="method post">POST</span><span class="path">/api/sensors/:id/readouts</span>
|
||||
<p class="desc">Add a new readout to an existing sensor. Timestamp is generated server-side.</p>
|
||||
<p class="section-label">curl</p>
|
||||
<pre><code>curl -X POST http://localhost:5000/api/sensors/1/readouts \
|
||||
<pre><code>curl -X POST {{ main_api_url }}/sensors/1/readouts \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"type": "temperature", "value": 22.5}'</code></pre>
|
||||
<p class="section-label">Response 201</p>
|
||||
|
||||
Reference in New Issue
Block a user