Crops

Crop is the catalog of crop types that a Cultivation references — for example, "Wheat" or "Corn". Unlike every other resource in Farm Management, it is not scoped to your company.

This page covers only what's specific to Crops. For the base URL, authentication, the response envelope, and the foreign-key _id convention, see Farm Management Overview.

Crop is a global, shared catalog, not scoped to your company — it has no company or created_by fields at all. List results are always sorted with "Wheat" first, then the rest. Any create, edit, or delete you perform here changes the shared catalog for every company on the platform, not just yours — use this endpoint carefully.

Endpoints

MethodPathPurpose
GET/crop/List crops
POST/crop/Create a crop (single object only — no bulk)
GET/crop/CROP_ID/Retrieve a single crop
PUT/crop/CROP_ID/Replace a crop
PATCH/crop/CROP_ID/Partially update a crop
DELETE/crop/CROP_ID/Delete a crop

Auth

Requires a Bearer token — see Farm Management Overview for how to send one.

Each action also requires a dynamic permission on top of the token:

ActionRequired permission
List / Retrievecrop.view
Createcrop.create
Update / Partial updatecrop.edit
Deletecrop.delete

A request with a valid token but missing the required permission gets an HTTP 403 with the structured body described in Farm Management Overview.

Create / update fields

FieldTypeRequired
namestring, max 255Yes
name_destring, max 255 (German name)Yes

No bulk create

Crops do not support bulk create. POST /crop/ only accepts a single object — send a JSON array and it will not be treated as a batch of crops the way it would be on Farms, Fields, Seasons, Cultivations, or Fertilization.

Status codes

StatusTrigger
200List, retrieve, create, or update succeeded.
204Delete succeeded.
400Validation failure (for example, missing name or name_de).
403Missing crop.view / crop.create / crop.edit / crop.delete permission.
404Crop not found.

Create request

curl -X POST https://backend.spacenus.de/api/v1.2/crop/ \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Corn",
    "name_de": "Mais"
  }'

Response:

{
  "status": "success",
  "message": "Crop created successfully.",
  "data": {
    "id": 12,
    "name": "Corn",
    "name_de": "Mais"
  }
}