Register harvest results
POST/biology/companies/:companyId/harvest/imports
Registers the harvest results. Once created, farmers can import the harvest results in Farmer.
Units. For one unit, send unitCode and harvestItems. For several units, send unitAllocations, in one of two ways:
- Only a
unitCodein each entry, and one combined list ofharvestItemsat the top level. Farmer divides the items over the units when the harvest is registered. harvestItemsin every entry, and none at the top level. Farmer keeps each unit's items as sent.
Each unit can appear once, and unitCode is not sent together with unitAllocations. Every unit must be a unit of the site. unitName is accepted in place of unitCode. Several units joined with / in either of them, for example 0001/0002, is the deprecated way to send the combined list.
Purchasers. Send purchaser for the whole harvest, or purchaserAllocations on every harvest item, but not both. One purchaser on an item takes the whole item, and totalCount and totalWeightKg can be left out, but are given together or not at all. Several purchasers on an item each need both, adding up to the item's. A purchaser can appear once per item. A name is at most 200 characters, a blank name counts as not sent, and a name is matched to an existing purchaser of the site's operation, ignoring case and surrounding spaces. A name that matches none or several is kept and flagged when the result is reviewed. An unknown name is created when the result is approved.
Plant mapping. processingPlant also selects the plant's own API format, which decides what each condition.code and qualityBand means. Without one, the default format is used. A value the format does not map is rejected with a 400 that names the value and the items that carry it.
Requirements. unitAllocations, purchaser and purchaserAllocations need the new harvest import to be enabled for the tenant. On those tenants harvestId can be at most 50 characters.
Sending a harvest again. A harvestId that is still pending for the unit replaces the pending import. One already imported in Farmer is rejected.
Request
Responses
- 201
- 400
- 403
- 404
Harvest results registered and import notification created. The body is the id of the import in Farmer. Use it to get the import back.
Response Headers
The address of the newly imported harvest result, for example /biology/companies/{companyId}/harvest/imports/87.
The harvest results were rejected and nothing is registered. details lists every problem found, each with the propertyName of the field it concerns.
The API user has no access in this company's Farmer tenant. A new API user must be given a role in Farmer before it can call the harvest operations.
The site identified by siteCode does not exist or is not accessible to the API user.