Introduction
The Aqua-IoT API provides a RESTful interface for managing IoT sensor data from aquarium and plant monitoring systems. The API enables you to submit sensor readings from various devices including temperature sensors, humidity sensors, water level monitors, light sensors (LDR), and TDS sensors.Base URL
Architecture
The API is built using Django Rest Framework and follows these principles:- RESTful Design: Standard HTTP methods and status codes
- Token Authentication: Secure API access using Django REST Framework token authentication
- JSON Format: All requests and responses use JSON
- ViewSets: Each sensor type has a dedicated viewset for data operations
- Serializers: Data validation and transformation using DRF serializers
Available Endpoints
The API provides the following endpoints for sensor data submission:| Endpoint | Method | Description |
|---|---|---|
/api/temperatura-aquario/ | POST | Submit aquarium temperature readings |
/api/temperatura-plantas/ | POST | Submit plant temperature readings |
/api/umidade/ | POST | Submit humidity readings |
/api/nivel/ | POST | Submit water level readings |
/api/ldr/ | POST | Submit light sensor (LDR) readings |
/api/tds/ | POST | Submit TDS (Total Dissolved Solids) readings |
Common Request Structure
All sensor endpoints share a common base structure inherited from theSensor model:
Sensor name or identifier
Sensor type (e.g., “Plantas”, “Acuario”)
Sensor group (e.g., “Grupo P” for plants, “Grupo A” for aquarium)
Unit of measurement for the sensor reading
Common Response Structure
Successful responses (HTTP 201) return the created object with all fields including:Auto-generated unique identifier
Sensor name
Sensor type
Sensor group
Timestamp when the record was created
Unit of measurement
Error Handling
The API uses standard HTTP status codes:| Status Code | Description |
|---|---|
| 201 | Created - Request successful |
| 400 | Bad Request - Invalid data |
| 401 | Unauthorized - Missing or invalid token |
| 403 | Forbidden - Insufficient permissions |
| 500 | Internal Server Error |
Error Response Format
Rate Limiting
Currently, no rate limiting is enforced. However, it’s recommended to implement reasonable request intervals when submitting sensor data.Data Models
All sensor models inherit from the abstractSensor base model which provides:
nome: CharField (max 50 characters)tipo: CharField (max 50 characters)grupo: CharField (max 50 characters)data_criacao: DateTimeField (auto-generated)
Next Steps
- Review the Authentication guide to get your API token
- Explore individual endpoint documentation for detailed request/response examples
- Check sensor-specific fields and validation rules
