Trait API endpoints
The new endpoints are in the existing CropTraitController
and require Method#id
. They operate on CropTraitObservation
(CTO) or CTOD:
- GET paged endpoint /observations/{methodId}/inventories that returns a
Page<Inventory>
: get distinct inventory fromCTO
for selectedmethod
- GET paged endpoint /observations/{methodId}/traits, returning
Page<CropTrait>
: get distinct crop trait fromCTO
for selectedmethod
- GET paged endpoint /observations-data/{methodId}/inventories that returns a
Page<Inventory>
: get distinct inventory fromCTOD
for selectedmethod
- GET paged endpoint /observations-data/{methodId}/traits returning
Page<CropTrait>
: get distinct crop trait fromCTOD
for selected method
For these methods to return "something" we implement an endpoint that ensures that at least one CTO or CTOD exists for the method
, cropTrait
and inventory
: a new CTO or CTOD record is added only if there is no existing record for the combination:
- POST endpoint /observations/ensure that receives
{ method: { id }, cropTraitId: [ 1, 3, 4 ..], inventoryId: [ 3, 5, 61, ... ]}
, creates newCTOs
if missing, and returns the number of newly added recordsint
. - POST endpoint /observations-data/ensure that receives
{ method: { id }, cropTraitId: [ 1, 3, 4 ..], inventoryId: [ 3, 5, 61, ... ]}
, creates newCTODs
if missing, and returns the number of newly added recordsint
.