The Crops API lets you define and track the crops cultivated in AgroPulse greenhouses. Each crop record captures the species, variety, optimal temperature and humidity ranges, soil moisture thresholds, planting date, and the crop’s current lifecycle stage. Lifecycle progression is modelled as an ordered state machine (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.
SEEDING → GROWING → FLOWERING → HARVESTING → DORMANT), and the API exposes dedicated endpoints to advance a crop to the next stage and to clone an existing crop into a new cycle.
Crops are intended to be associated with a greenhouse in your application logic. While the
crops table does not enforce a foreign key to greenhouses at the API level, sensor alert thresholds and IoT monitoring rules in AgroPulse are evaluated relative to the crop’s tempMin/tempMax, humidityMin/humidityMax, and soilMoistureMin/soilMoistureMax fields.Crop lifecycle stages
ThecurrentStage field is an enum with the following ordered values:
| Stage | Description |
|---|---|
SEEDING | Germination / initial sowing — the default stage for a new crop. |
GROWING | Vegetative growth phase. |
FLOWERING | Flowering and pollination phase. |
HARVESTING | Active harvest phase. |
DORMANT | Off-season rest or dormancy period. |
POST /api/crops/{id}/advance to move a crop forward to the next stage in this sequence.
GET /api/crops — List all crops
GET /api/crops — List all crops
Returns every crop in the system, regardless of active status.Response — array of crop objects.
Unique crop identifier.
Crop name (e.g.
"Tomate").Cultivar or variety (e.g.
"Cherry").Minimum optimal temperature in °C.
Maximum optimal temperature in °C.
Minimum optimal relative humidity in %.
Maximum optimal relative humidity in %.
Minimum optimal soil moisture in %.
Maximum optimal soil moisture in %.
ISO-8601 date of sowing (e.g.
"2024-03-01"). Defaults to today.Current lifecycle stage enum value. Defaults to
SEEDING.Whether this crop is currently active. Defaults to
true.GET /api/crops/active — List active crops
GET /api/crops/active — List active crops
Returns only crops where
active is true.GET /api/crops/{id} — Get crop by ID
GET /api/crops/{id} — Get crop by ID
Returns a single crop by its numeric ID.Path parametersReturns
The crop ID.
404 Not Found when no crop with that ID exists.POST /api/crops — Create a crop
POST /api/crops — Create a crop
Creates a new crop record. The Response — the created crop object.
currentStage defaults to SEEDING and plantingDate defaults to today when omitted.Request bodyCrop name (e.g.
"Pepino", "Lechuga").Cultivar or variety name (e.g.
"Romana", "Hothouse").Minimum optimal temperature in °C.
Maximum optimal temperature in °C.
Minimum optimal relative air humidity in %.
Maximum optimal relative air humidity in %.
Minimum optimal soil moisture in %.
Maximum optimal soil moisture in %.
ISO-8601 date of sowing (e.g.
"2024-04-15"). Defaults to the current date.Initial lifecycle stage. One of
SEEDING, GROWING, FLOWERING, HARVESTING, DORMANT. Defaults to SEEDING.Whether the crop is active. Defaults to
true.PUT /api/crops/{id} — Update a crop
PUT /api/crops/{id} — Update a crop
Replaces a crop record with the provided body. The Request body — same fields as
id from the path takes precedence — any id in the request body is overwritten.Path parametersThe crop ID to update.
POST /api/crops. All fields are optional; omitted fields retain their existing values as managed by the service layer.Response — the updated crop object.DELETE /api/crops/{id} — Delete a crop
DELETE /api/crops/{id} — Delete a crop
Permanently deletes a crop record.Path parametersReturns
The crop ID to delete.
204 No Content on success with an empty body.POST /api/crops/{id}/advance — Advance lifecycle stage
POST /api/crops/{id}/advance — Advance lifecycle stage
Advances the crop’s Response — the updated crop object with the new
currentStage to the next value in the sequence: SEEDING → GROWING → FLOWERING → HARVESTING → DORMANT.Path parametersThe crop ID to advance.
currentStage.If the crop is already in the final stage (
DORMANT), the behavior is determined by the CropService implementation. Inspect the service for the exact boundary condition handling.POST /api/crops/{id}/clone — Clone a crop for a new cycle
POST /api/crops/{id}/clone — Clone a crop for a new cycle
Creates a copy of an existing crop using the Prototype pattern. The clone resets the planting date to today and the stage to Response — the newly created crop object (new
SEEDING, preserving all environmental threshold settings from the original.Path parametersThe ID of the crop to clone.
id, plantingDate = today, currentStage = SEEDING).