Skip to main content

Add Water Values

Endpoint

POST /api/environments/<int:environment_id>/values/"

Description

This endpoint allows you to add water values to a specific environment. Each environment belongs to a user, and you can only submit water values based on the upload frequency defined by your subscription tier. This ensures resource conservation and prevents spamming of the API.

Upload Frequency

  • Hobby Plan: Can upload new water values every 12 hours.
  • Business Plan: Can upload new water values every 3 hours.
  • Advanced Plan: Can upload new water values every 30 minutes.

If you try to submit values before the allowed time frame, you'll receive a 429 Too Many Requests error.

Water Parameters

The following water parameters are currently supported by the system. Each parameter has an associated unit:

Parameter NameUnit
PHpH
Temperature°C
TDSppm
Oxygenmg/L
Ammoniappm
Nitriteppm
Nitrateppm
Phosphateppm
Carbon Dioxidemg/L
Salinityppt
General HardnessdGH
Carbonate HardnessdKH
Copperppm
Ironppm
Calciumppm
Magnesiumppm
Potassiumppm
Chlorineppm
Redox PotentialmV
Silicappm
Boronppm
Strontiumppm
Iodineppm
Molybdenumppm
Sulfateppm
Organic Carbonppm
TurbidityNTU
ConductivityµS/cm
Suspended Solidsmg/L
Fluorideppm
Bromineppm
Chlorideppm

Authentication

  • API Key: You need to be authenticated with your API Key submit water values. Your api key can be found under getting your profile information or in your dashboard.

Request Example

Here’s an example request to add water values for an environment:

Request URL

POST /api/environments/3/values/

Request Body

{
"Temperature": 29.9,
"PH": 8.2,
"TDS": 630
}

Response

  • 201 Created: Water values were successfully added.
  • 400 Bad Request: There was an error with the request, such as missing or invalid fields.
  • 404 Not Found: The environment does not exist or does not belong to the user.
  • 429 Too Many Requests: You are trying to submit values before the allowed upload frequency time.

Example Response

{
"id": 4,
"environment": 3,
"parameter": {
"id": 1,
"name": "PH",
"unit": "pH"
},
"value": "8.200",
"measured_at": "2024-09-23T11:19:09.432111Z"
},
{
"id": 5,
"environment": 3,
"parameter": {
"id": 2,
"name": "Temperature",
"unit": "°C"
},
"value": "29.900",
"measured_at": "2024-09-23T11:19:09.432111Z"
},
{
"id": 6,
"environment": 3,
"parameter": {
"id": 3,
"name": "TDS",
"unit": "ppm"
},
"value": "630.000",
"measured_at": "2024-09-23T11:19:09.432111Z"
}