Passer au contenu

Limited
Create library finished product chapter

Requête

Creates a standalone finished product chapter owned by the calling company, born as a PUBLISHED active version (drafts stay internal). Visible to nobody until shared (POST .../{chapterId}/share).

Sécurité
oauth2(Portées requises: t1_api)
Corpsapplication/jsonobligatoire
namestringobligatoire

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).

productPhotosobject(ProductPhotos)

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.

shelfLifeobject(FinishedProductShelfLife)

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.

consumerShelfLifeobject(FinishedProductConsumerShelfLife)

Section shelf_life, second block - the shelf life as the consumer sees it.

storageConditionsArray of objects or null(StorageCondition)

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.

preservationMethodIdsArray of strings or null, (uuid)

PreservationMethod reference list. Replaces the list in full; null or absent leaves it unchanged, [] clears it.

traceabilityobject(Traceability)

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.

curl -i -X POST \
  https://apis.traceone.com/spec/v2/library/food/finished-product-chapters \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -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"
      ]
    }
  }'

Réponses

The chapter was created and published

Corpsapplication/json
chapterIdstring, (uuid)
Réponse
{ "chapterId": "2a48aff7-27e7-4ab6-9471-1ee9c5632811" }