List Meters in Workspace
curl -X GET https://api.example.com/meters/workspace123/ \
-H "Authorization: Bearer YOUR_TOKEN"
{
"message": "Meters retrieved successfully",
"meters": [
{
"id": "meter123",
"name": "Lake Monitor A",
"location": {
"name_location": "Lake Superior",
"lat": 47.6062,
"lon": -122.3321
},
"state": "connected",
"rol": "owner"
}
]
}
Retrieve all meters in a workspace.
Endpoint: GET /meters/{id_workspace}/
Authentication: Required (Bearer token)
Path Parameters
Response
Create Meter
curl -X POST https://api.example.com/meters/workspace123/ \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "River Monitor B",
"location": {
"name_location": "Mississippi River",
"lat": 38.6270,
"lon": -90.1994
}
}'
{
"message": "Meter created successfully",
"meter": {
"id": "meter456",
"name": "River Monitor B",
"location": {
"name_location": "Mississippi River",
"lat": 38.6270,
"lon": -90.1994
},
"state": "disconnected",
"rol": "owner"
}
}
Create a new meter in a workspace.
Endpoint: POST /meters/{id_workspace}/
Authentication: Required (Bearer token)
Path Parameters
Request Body
Get Meter Details
curl -X GET https://api.example.com/meters/workspace123/meter123/ \
-H "Authorization: Bearer YOUR_TOKEN"
{
"message": "Meter retrieved successfully",
"meter": {
"id": "meter123",
"name": "Lake Monitor A",
"location": {
"name_location": "Lake Superior",
"lat": 47.6062,
"lon": -122.3321
},
"state": "connected",
"rol": "owner"
}
}
Get details of a specific meter.
Endpoint: GET /meters/{id_workspace}/{id_meter}/
Authentication: Required (Bearer token)
Path Parameters
Update Meter
curl -X PUT https://api.example.com/meters/workspace123/meter123/ \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Lake Monitor",
"location": {
"name_location": "Lake Superior North",
"lat": 47.7062,
"lon": -122.4321
}
}'
{
"message": "Meter updated successfully",
"meter": {
"id": "meter123",
"name": "Updated Lake Monitor",
"location": {
"name_location": "Lake Superior North",
"lat": 47.7062,
"lon": -122.4321
},
"state": "connected",
"rol": "owner"
}
}
Update meter information.
Endpoint: PUT /meters/{id_workspace}/{id_meter}/
Authentication: Required (Bearer token)
Path Parameters
Request Body
Updated location information
Delete Meter
curl -X DELETE https://api.example.com/meters/workspace123/meter123/ \
-H "Authorization: Bearer YOUR_TOKEN"
{
"message": "Meter deleted successfully",
"meter": {
"id": "meter123",
"name": "Lake Monitor A"
}
}
Delete a meter.
Endpoint: DELETE /meters/{id_workspace}/{id_meter}/
Authentication: Required (Bearer token)
Path Parameters
Pair Meter (Generate Connection Token)
curl -X POST https://api.example.com/meters/workspace123/pair/meter123/ \
-H "Authorization: Bearer YOUR_TOKEN"
{
"message": "Connection received",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Generate a connection token for pairing a physical meter device.
Endpoint: POST /meters/{id_workspace}/pair/{id_meter}/
Authentication: Required (Bearer token)
Path Parameters
Response
Connection token for the meter device (valid for 30 days)
Validate Meter Token
curl -X POST https://api.example.com/meters/workspace123/pair/meter123/validate/ \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}'
{
"message": "Token valido"
}
Validate a meter connection token.
Endpoint: POST /meters/{id_workspace}/pair/{id_meter}/validate/
Authentication: Required (Bearer token)
Path Parameters
Request Body
Connection token to validate
Query Meter Records
curl -X GET "https://api.example.com/meters/records/workspace123/meter123/?start_date=2024-01-01&end_date=2024-01-31&sensor_type=ph&limit=50" \
-H "Authorization: Bearer YOUR_TOKEN"
{
"message": "Records retrieved successfully",
"records": {
"records": [
{
"id": "record123",
"datetime": "2024-01-15T10:30:00Z",
"sensor_type": "ph",
"value": 7.2
}
],
"next_index": "eyJpZCI6Im5leHQifQ=="
}
}
Query sensor records from a meter with filters.
Endpoint: GET /meters/records/{id_workspace}/{id_meter}/
Authentication: Required (Bearer token)
Path Parameters
Query Parameters
Start date for filtering (ISO 8601 format)
End date for filtering (ISO 8601 format)
Filter by sensor type: ph, temperature, conductivity, tds, turbidity
Number of records to retrieve
Get Sensor Records by Type
curl -X GET "https://api.example.com/meters/records/workspace123/meter123/ph/?limit=20" \
-H "Authorization: Bearer YOUR_TOKEN"
{
"message": "Records retrieved successfully",
"records": {
"records": [
{
"id": "record456",
"datetime": "2024-01-15T10:30:00Z",
"value": 7.2
}
],
"next_index": null
}
}
Get records for a specific sensor type.
Endpoint: GET /meters/records/{id_workspace}/{id_meter}/{sensor_name}/
Authentication: Required (Bearer token)
Path Parameters
Sensor type: ph, temperature, conductivity, tds, or turbidity
Query Parameters
Number of records to retrieve
Get Weather Data for Meter
curl -X GET "https://api.example.com/meters/workspace123/weather/meter123/?last_days=7" \
-H "Authorization: Bearer YOUR_TOKEN"
{
"success": true,
"message": "Weather data retrieved",
"data": {
"current": {
"temp_c": 18.5,
"humidity": 65,
"condition": "Partly cloudy"
}
}
}
Get current or historical weather data for the meter’s location.
Endpoint: GET /meters/{id_workspace}/weather/{id_meter}/
Authentication: Required (Bearer token)
Path Parameters
Query Parameters
Number of days of historical weather data (if omitted, returns current weather)
Response
Whether the request was successful
Weather data from external API