Skip to main content

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

http://127.0.0.1:8000/api/

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:
EndpointMethodDescription
/api/temperatura-aquario/POSTSubmit aquarium temperature readings
/api/temperatura-plantas/POSTSubmit plant temperature readings
/api/umidade/POSTSubmit humidity readings
/api/nivel/POSTSubmit water level readings
/api/ldr/POSTSubmit light sensor (LDR) readings
/api/tds/POSTSubmit TDS (Total Dissolved Solids) readings

Common Request Structure

All sensor endpoints share a common base structure inherited from the Sensor model:
nome
string
required
Sensor name or identifier
tipo
string
required
Sensor type (e.g., “Plantas”, “Acuario”)
grupo
string
required
Sensor group (e.g., “Grupo P” for plants, “Grupo A” for aquarium)
unidade_medida
string
required
Unit of measurement for the sensor reading
Additional fields vary by sensor type (see individual endpoint documentation).

Common Response Structure

Successful responses (HTTP 201) return the created object with all fields including:
id
integer
Auto-generated unique identifier
nome
string
Sensor name
tipo
string
Sensor type
grupo
string
Sensor group
data_criacao
datetime
Timestamp when the record was created
unidade_medida
string
Unit of measurement

Error Handling

The API uses standard HTTP status codes:
Status CodeDescription
201Created - Request successful
400Bad Request - Invalid data
401Unauthorized - Missing or invalid token
403Forbidden - Insufficient permissions
500Internal Server Error

Error Response Format

{
  "field_name": [
    "Error message describing the issue"
  ]
}

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 abstract Sensor base model which provides:
  • nome: CharField (max 50 characters)
  • tipo: CharField (max 50 characters)
  • grupo: CharField (max 50 characters)
  • data_criacao: DateTimeField (auto-generated)
Each sensor type extends this base with specific measurement fields.

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

Build docs developers (and LLMs) love