CROPWISE SERVICES
Working with Seasons π±
Overview
Seasons enable you to organize crop production into time-bounded cycles for comprehensive yield tracking and agronomic planning.
Cardinality summary
- Workspace β 1..* Organizations
- Organization β 1..* Seasons
Workspace
βββ Organization
βββ Seasons 1..*
Key Concepts
Concept | Description |
---|---|
Season | Time-bounded crop production period (start_date , end_date ) |
Crop Zone | Unique seasonal instance of a Field (created via Crop Zones API) |
API Documentation
For complete API reference including request/response schemas, authentication, and interactive testing, visit:
π Seasons API Documentation - Interactive API documentation with request/response examples
Available Endpoints
Method & Path | Purpose |
---|---|
POST /v2/seasons | Create a season |
GET /v2/seasons/{id} | Retrieve season details |
PUT /v2/seasons/{id} | Update season metadata |
DELETE /v2/seasons/{id} | Soft-delete a season |
Best Practices
Practice | Benefit |
---|---|
Enforce unique season names per org early | Avoid failed POST retries |
Keep season timeframe realistic | Accurate aggregation & reporting |
Business Rules
- Permission required: caller must have appropriate season create/update rights for the organization.
- Optional client-supplied
id
must be unused; existing ID causes rejection (no overwrite). name
must be unique within the organization (case-insensitive) on both create and update.start_date
must be strictly beforeend_date
(validated on create and update).crop_id
(if provided) must reference an existing crop.- Changing
crop_id
is only allowed when no fields / crop zones are linked to the season. - Season must exist for update operations.
- Persistence enforces uniqueness (duplicate id or name triggers conflict codes).
- Invalid date ordering immediately rejects the request (no partial persistence).
- Crop change guard prevents altering historical agronomic context inconsistently.
Error Codes
Detailed (non-exhaustive) errors for create and update flows.
Creation
Code / Exception | HTTP | Message | Trigger |
---|---|---|---|
ESEA025 | 409 CONFLICT | Season already exists | Season with same ID already present |
ESEA008 | 400 BAD_REQUEST | Start date cannot be after end date | end_date <= start_date |
ESEA005 | 409 CONFLICT | Season duplicated | Season name already exists in organization |
ESEA006 | 400 BAD_REQUEST | Invalid variety | Varieties not valid for the crop |
ESEA016 | 404 NOT_FOUND | Crop does not exist | Provided crop_id not found |
Update
Code / Exception | HTTP | Message | Trigger |
---|---|---|---|
ESEA009 | 404 NOT_FOUND | Season does not exist | Target season to update missing |
ESEA008 | 400 BAD_REQUEST | Start date cannot be after end date | end_date <= start_date after change |
ESEA005 | 409 CONFLICT | Season duplicated | New name clashes in organization |
ESEA011 | 400 BAD_REQUEST | Cannot change crop if there are fields linked to it | Attempt to change crop with linked fields |
ESEA016 | 404 NOT_FOUND | Crop does not exist | New crop_id not found |