Skip to main content

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

id_workspace
string
required
Workspace ID

Response

message
string
Success message
meters
array
Array of meter objects

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

id_workspace
string
required
Workspace ID

Request Body

name
string
required
Meter name
location
object
required
Location information

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

id_workspace
string
required
Workspace ID
id_meter
string
required
Meter ID

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

id_workspace
string
required
Workspace ID
id_meter
string
required
Meter ID

Request Body

name
string
required
Updated meter name
location
object
required
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

id_workspace
string
required
Workspace ID
id_meter
string
required
Meter ID to delete

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

id_workspace
string
required
Workspace ID
id_meter
string
required
Meter ID to pair

Response

message
string
Success message
token
string
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

id_workspace
string
required
Workspace ID
id_meter
string
required
Meter ID

Request Body

token
string
required
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

id_workspace
string
required
Workspace ID
id_meter
string
required
Meter ID

Query Parameters

start_date
string
Start date for filtering (ISO 8601 format)
end_date
string
End date for filtering (ISO 8601 format)
sensor_type
string
Filter by sensor type: ph, temperature, conductivity, tds, turbidity
limit
number
default:"10"
Number of records to retrieve
index
string
Pagination index

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

id_workspace
string
required
Workspace ID
id_meter
string
required
Meter ID
sensor_name
string
required
Sensor type: ph, temperature, conductivity, tds, or turbidity

Query Parameters

limit
number
default:"10"
Number of records to retrieve
index
string
Pagination index

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

id_workspace
string
required
Workspace ID
id_meter
string
required
Meter ID

Query Parameters

last_days
number
Number of days of historical weather data (if omitted, returns current weather)

Response

success
boolean
Whether the request was successful
message
string
Response message
data
object
Weather data from external API

Build docs developers (and LLMs) love