How to Log Data

This data logging service supports IoT device webhooks and provides APIs to store and retrieve sensor data. Use the new webhook format for multi-device, multi-sensor data logging.

🆕 New Webhook Format (Recommended)

Log Webhook Data (POST):

POST /logger_v2.php

Send IoT webhook data with multiple devices and sensor readings.

Webhook JSON Structure:

curl -X POST http://localhost/logger_v2.php \ -H "Content-Type: application/json" \ -d '{ "account_id": "your_account_id", "devices": [ { "index": 0, "id": 101, "group": 42, "type": "w", "version": 1 } ], "data": [ { "_d": 0, "temperature": 23.45, "solar_voltage": 4.12, "battery_voltage": 3.85, "vcc_voltage": 3.30 } ] }'

Retrieve Data (GET):

GET /logger_v2.php

Query sensor data with enhanced filtering options.

Get latest 10 records:

curl "http://localhost/logger_v2.php?last=10"

Filter by device:

curl "http://localhost/logger_v2.php?device_id=101&limit=20"

Filter by sensor type:

curl "http://localhost/logger_v2.php?data_key=temperature&limit=50"

Filter by group:

curl "http://localhost/logger_v2.php?group_id=42"

Time range filtering:

curl "http://localhost/logger_v2.php?from=2024-01-01T00:00:00&to=2024-01-31T23:59:59"

Combined filters:

curl "http://localhost/logger_v2.php?account_id=your_account_id&device_id=101&data_key=temperature&last=5"

📊 Data Structure

The new format organizes data hierarchically:

Benefits: