Crops

This object contains a mix of metadata about the crop, the parcel it's grown on, and specifics about the planting and harvesting timeline.

The crops provides a comprehensive view of a single crop's lifecycle in the rotation plan, from planting to harvest, including specific details about the crop variety and performance metrics. It's a useful structure for an API serving users in agriculture, especially for precision farming applications where managing the details of each crop rotation is crucial for optimizing yield and soil health.

List all crops

get

Returns a paginated list of all active crops accessible to the authenticated user. Results are filtered by the user's farm ownership and ordered by sowing date (newest first). Superusers can see all crops.

Query parameters
parcelintegerOptional

Filter crops by parcel ID

parcel_idintegerOptional

Alternative filter for parcel ID (deprecated, use parcel instead)

Responses
chevron-right
200Success
application/json
get
/api/crops/

Retrieve a crop

get

Returns the details of a specific crop by its ID. The crop must belong to a parcel on a farm accessible by the authenticated user.

Path parameters
idstringRequired
Responses
chevron-right
200Success
application/json
get
/api/crops/{id}/

Get crops associated with a parcel

get

Retrieves all active crops associated with a specific parcel, ordered by sowing date (most recent first).

Crop Fields:

  • id: Unique identifier

  • key: UUID key

  • family: Crop family object with id and name

  • parcel: ID of the associated parcel

  • name: Optional crop name

  • campaign: Growing campaign (e.g., '2024/2025')

  • variety: Crop variety

  • sowing: Sowing date

  • closure: Closure/harvest date

  • harvested_qty: Harvested quantity

  • irrigation_type: Optional irrigation type

  • soil_type: Optional soil type

Path parameters
idstringRequired
Responses
chevron-right
200

List of crops associated with the parcel

application/json
get
/api/parcels/{id}/crops/

Create a new crop

post

Creates a new crop record for a parcel. The crop must be associated with an existing parcel that belongs to a farm accessible by the authenticated user. If no campaign is provided, it defaults to the current year range (e.g., '2026/2027').

Body
idintegerRead-onlyRequired
keystring · uuidRead-onlyRequired
namestring · max: 20 · nullableOptional
campaignstring · max: 20 · nullableOptional
areanumber · double · nullableOptional
varietystring · max: 100 · nullableOptional
harvested_qtynumber · double · nullableOptional
sowingstring · date · nullableOptional
closurestring · date · nullableOptional
is_activebooleanOptional
createdstring · date-timeRead-onlyRequired
modifiedstring · date-timeRead-onlyRequired
parcelinteger · nullableOptional
Responses
post
/api/crops/

Update a crop

put

Fully updates an existing crop record. All fields will be replaced with the provided values. The crop must belong to a parcel on a farm accessible by the authenticated user.

Path parameters
idstringRequired
Body
idintegerRead-onlyRequired
keystring · uuidRead-onlyRequired
namestring · max: 20 · nullableOptional
campaignstring · max: 20 · nullableOptional
areanumber · double · nullableOptional
varietystring · max: 100 · nullableOptional
harvested_qtynumber · double · nullableOptional
sowingstring · date · nullableOptional
closurestring · date · nullableOptional
is_activebooleanOptional
createdstring · date-timeRead-onlyRequired
modifiedstring · date-timeRead-onlyRequired
parcelinteger · nullableOptional
Responses
chevron-right
200Success
application/json
put
/api/crops/{id}/

Partially update a crop

patch

Partially updates an existing crop record. Only the provided fields will be updated. The crop must belong to a parcel on a farm accessible by the authenticated user.

Path parameters
idstringRequired
Body
idintegerRead-onlyOptional
keystring · uuidRead-onlyOptional
namestring · max: 20 · nullableOptional
campaignstring · max: 20 · nullableOptional
areanumber · double · nullableOptional
varietystring · max: 100 · nullableOptional
harvested_qtynumber · double · nullableOptional
sowingstring · date · nullableOptional
closurestring · date · nullableOptional
is_activebooleanOptional
createdstring · date-timeRead-onlyOptional
modifiedstring · date-timeRead-onlyOptional
parcelinteger · nullableOptional
Responses
chevron-right
200Success
application/json
patch
/api/crops/{id}/

Delete a crop

delete

Deletes a crop record. This is a hard delete operation. The crop must belong to a parcel on a farm accessible by the authenticated user.

Path parameters
idstringRequired
Responses
delete
/api/crops/{id}/

No content

Last updated