MCPcopy Create free account
hub / github.com/bdring/FluidNC / handle_root

Method handle_root

examples/http_command/http_command_server.py:317–347  ·  view source on GitHub ↗

Respond to / with API documentation

(self)

Source from the content-addressed store, hash-verified

315 self.send_json_response(response_data, 200)
316
317 def handle_root(self):
318 """Respond to / with API documentation"""
319 response_data = {
320 "api": "HttpCommand Example Server",
321 "version": "2.0",
322 "endpoints": {
323 "GET": {
324 "/api/status": "Status with temperature, humidity, uptime",
325 "/api/temperature": "Single temperature value",
326 "/api/humidity": "Single humidity value",
327 "/api/read": "Multiple sensors (temp, humidity, pressure)",
328 "/api/health": "Health check with CPU and memory",
329 "/api/states/sensor.*": "Home Assistant sensor state",
330 "/api/jobs/next": "Get next job from queue",
331 "/api/v1/query": "Prometheus instant query",
332 "/health": "Simple health check"
333 },
334 "POST": {
335 "/api/webhook/*": "Receive webhook notifications",
336 "/metrics/job/*/instance/*": "Prometheus pushgateway metrics",
337 "/api/v2/write": "InfluxDB line protocol write"
338 },
339 "PUT": {
340 "/api/jobs/*": "Update job status"
341 },
342 "DELETE": {
343 "/api/v1/cleanup": "Cleanup old logs"
344 }
345 }
346 }
347 self.send_json_response(response_data)
348
349 def send_json_response(self, data, status_code=200):
350 """Send a JSON response"""

Callers 1

do_GETMethod · 0.95

Calls 1

send_json_responseMethod · 0.95

Tested by

no test coverage detected