Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/diarpicu2022-commits/backend-AgroPulse/llms.txt

Use this file to discover all available pages before exploring further.

Alerts are produced by the AgroPulse anomaly-detection engine whenever a sensor reading crosses a configured threshold. They can also be created manually — for example, to record an operator observation or to test notification delivery. Each alert carries a severity level, an optional title and type string, and a flag indicating whether it has been dispatched to recipients.
All list responses return alerts ordered by createdAt descending, so the most recent alert is always first.

Endpoints

List all alerts

Retrieves every alert in the system.
GET /api/alerts
Response Returns an object with an alerts array.
alerts
Alert[]
required
Array of alert objects ordered by createdAt descending.
curl http://localhost:8080/api/alerts

Create an alert

Posts a new alert record. Use this to inject manual observations or to trigger notification delivery outside of the automated pipeline.
POST /api/alerts
Request body
message
string
required
Full alert message describing the anomaly or event.
title
string
Short human-readable title for the alert.
type
string
Free-form category string (e.g. "TEMPERATURE", "HUMIDITY").
greenhouseId
number
ID of the greenhouse this alert belongs to.
sent
boolean
default:"false"
Whether the alert should be marked as already dispatched to recipients.
level
string
default:"INFO"
Severity level. Accepted values:
ValueMeaning
INFOInformational, no action required.
WARNINGCondition requires attention.
CRITICALImmediate intervention needed.
Invalid values are silently coerced to INFO.
curl -X POST http://localhost:8080/api/alerts \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Low humidity",
    "message": "Relative humidity dropped below 40% in zone B.",
    "type": "HUMIDITY",
    "greenhouseId": 3,
    "level": "WARNING",
    "sent": false
  }'

Mark an alert as read

Acknowledges an alert by setting its read flag to true.
PUT /api/alerts/{id}/read
Path parameters
id
number
required
The ID of the alert to acknowledge.
Returns the updated alert object. Responds with 404 Not Found if no alert with the given ID exists.
curl -X PUT http://localhost:8080/api/alerts/42/read

Delete an alert

Permanently removes an alert record.
DELETE /api/alerts/{id}
Path parameters
id
number
required
The ID of the alert to delete.
Returns { "deleted": true } on success. Responds with 404 Not Found if the alert does not exist.
curl -X DELETE http://localhost:8080/api/alerts/42

Build docs developers (and LLMs) love