Full replace of the chapter's active published version, IN PLACE — no new version is created. Every linked specification reads this same version, so all of them see the update immediately. The caller must be the chapter's owner company. When the chapter is locked (a linked specification entered signature) content can no longer change in place — the write returns 422 INVALID_RESOURCE_STATE with no paramName, since nothing in the payload is at fault; adopting a NEW version created in the product is per-spec, via the .../link endpoints.
Optional optimistic concurrency: the ETag returned by the chapter GET. When provided, the write is rejected with 412 if the specification changed since the chapter was read (anything on it: another chapter, a contact, a share), or, for a library chapter, if the chapter changed. Guards against concurrent writers within the same owner company (cross-company overwrite is already impossible — the chapter is the ownership boundary).
Library display name of the chapter, shown in the Library screen. Unique among the owner company's library chapters — a duplicate is a 422 with errorCode NAME_ALREADY_USED (paramName name).
The product photos of the finished product chapter. Three separate lists of file ids - packaged, sectioned, unpackaged - the category is the list an id is in, not a property of the photo. There is no per-photo name or description to write: the file name comes from the file itself.
Each list replaces the stored one in full; null or absent leaves that list unchanged, [] clears it. Every id must be a file of type "product picture" owned by your company.
Section shelf_life, first block. This chapter is where shelf life is DECLARED; the labelling chapter's copy of it is derived. The five durations are independent: the guaranteed shelf life of the product, and how long it keeps at each stage.
guaranteedShelfLife.duration exists only while indicationId is set - clearing the id deletes the duration. A payload carrying a duration with no indicationId is therefore refused with a 422 naming guaranteedShelfLife.indicationId, rather than answering 200 having dropped it.
Section shelf_life, second block - the shelf life as the consumer sees it.
Replaces the storage-condition list in full, keyed on conditionId: a row the array does not carry is removed. null or absent leaves the list unchanged; send [] to clear it.
PreservationMethod reference list. Replaces the list in full; null or absent leaves it unchanged, [] clears it.
Section traceability: the batch/lot formatting, the batch size, the sample-storage policy and the procedure files.
sampleStorage follows the materials' sample-storage rule: sending the object turns sample-storage acceptance on, omitting it leaves the chapter with none. Turning acceptance off deletes the block, so there is no acceptSampleStorage flag to write - the object's presence is the flag. Its shape is the materials' one without size and duration.
- Productionhttps://apis.traceone.com/spec/v2/library/food/finished-product-chapters/{chapterId}
curl -i -X PUT \
'https://apis.traceone.com/spec/v2/library/food/finished-product-chapters/{chapterId}' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-H 'If-Match: string' \
-d '{
"name": "string",
"productPhotos": {
"packaged": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"sectioned": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"unpackaged": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
]
},
"shelfLife": {
"guaranteedShelfLife": {
"indicationId": "2e9e82e6-c79a-41f2-b826-14aafb6d99b9",
"duration": {
"value": 0,
"unitId": "b3eb5f92-604a-46b9-9881-9d84000fd7ed"
}
},
"production": {
"value": 0,
"unitId": "b3eb5f92-604a-46b9-9881-9d84000fd7ed"
},
"packaging": {
"value": 0,
"unitId": "b3eb5f92-604a-46b9-9881-9d84000fd7ed"
},
"shipping": {
"value": 0,
"unitId": "b3eb5f92-604a-46b9-9881-9d84000fd7ed"
},
"delivery": {
"value": 0,
"unitId": "b3eb5f92-604a-46b9-9881-9d84000fd7ed"
},
"protocolFileIds": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
]
},
"consumerShelfLife": {
"beforeOpeningIndicationId": "661e052b-d1e8-4a19-bacb-cd3e47f97623",
"afterOpening": {
"value": 0,
"unitId": "b3eb5f92-604a-46b9-9881-9d84000fd7ed"
},
"shelfLifeTesting": true
},
"storageConditions": [
{
"conditionId": "1e06e0eb-07f6-4fcd-8750-870cbafd1693",
"storageId": "0ff8924f-6eda-471e-914f-d650d8be19eb",
"temperature": {
"unitId": "b3eb5f92-604a-46b9-9881-9d84000fd7ed",
"minimumValue": 0,
"maximumValue": 0
},
"humidity": {
"minimumValue": 0,
"maximumValue": 0
},
"keepAwayFromLight": true
}
],
"preservationMethodIds": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"traceability": {
"batchLotNumberFormatting": "string",
"productionBatchSize": "string",
"samplesKeptPerBatch": 0,
"sampleRetentionTime": {
"value": 0,
"unitId": "b3eb5f92-604a-46b9-9881-9d84000fd7ed"
},
"sampleStorage": {
"storageConditionTemperatureId": "711b146f-39be-4e0c-bfff-e4f9fd631959",
"temperatureUnitOfMeasureId": "65d208c6-bfd0-448c-b9a1-80fc4acff2c4",
"minimumTemperature": 0,
"maximumTemperature": 0,
"minimumHumidity": 0,
"maximumHumidity": 0,
"keepAwayFromLight": true
},
"procedureFileIds": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
]
}
}'The chapter was replaced in place (active version). Read it back, with its new ETag, from the chapter GET.
Aucun contenu