Passer au contenu

Limited
Create library flavor

Requête

Creates a flavor owned by the calling company, born as a published library item — immediately referenceable from recipes and composites. Minimal payloads are accepted (name, commercialName and flavorType).

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

Unique per owning company (422 on duplicate, errorCode NAME_ALREADY_USED)

internalCodestring or null
commercialNamestringobligatoire

Required: the material is published on create, and a published material carries a commercial name.

flavorTypestringobligatoire

Required: it is set once at creation and can never be changed afterwards, and flavour vs smoke flavouring is a distinct regulatory category.

Enum:"flavor""smokeFlavor"
allergensobject(MaterialAllergensWrite)
characteristicsArray of objects or null(MaterialCharacteristicWrite)
suppliersArray of objects or null(MaterialSupplierWrite)
sampleStorageobject(MaterialSampleStorageWrite)

Sample storage conditions. Sending the object turns sample storage acceptance on for the material; omitting it leaves the material with no sample storage.

Humidity and temperature do not have the same precision, and the difference is the domain's: SampleStorage.Humidity is a NumericRange of precision 0 and its temperature a NumericRange of precision 1. So humidity is whole percents and temperature goes to a tenth, and both are stated here rather than left to be discovered against a 422.

controlPlansArray of objects or null(MaterialControlPlanWrite)
certificateIdsArray of strings or null, (uuid)(MaterialCertificateIds)

Existing certificates, by id. An unknown id is a 422 naming the field.

attachmentFileIdsArray of strings or null, (uuid)(MaterialAttachmentFileIds)

Files uploaded through the document API and referenced here by id. Each must be owned by your company and be of type "material-technical-datasheet" (shown as Technical data sheet) or the default material type (shown as Other documents); anything else is a 422 naming the field.

curl -i -X POST \
  https://apis.traceone.com/spec/v2/library/materials/flavors \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "string",
    "internalCode": "string",
    "commercialName": "string",
    "flavorType": "flavor",
    "allergens": {
      "present": [
        "497f6eca-6276-4993-bfeb-53cbbbba6f08"
      ],
      "unintentionallyPresent": [
        "497f6eca-6276-4993-bfeb-53cbbbba6f08"
      ]
    },
    "characteristics": [
      {
        "characteristicId": "1df5b437-b149-405c-a522-314a29cc1d0d",
        "libraryCharacteristicId": "c199d322-c3f0-481d-8ab8-f020c457ae1e",
        "name": "string",
        "typeId": "caab7c42-4ce7-4bd5-bbab-6017cec730b7",
        "unitOfMeasureId": "fd215922-b7a3-49a8-9803-63113a404f96",
        "quantity": 0,
        "target": 0,
        "lowerTarget": 0,
        "upperTarget": 0,
        "tolerance": 0,
        "lowerTolerance": 0,
        "upperTolerance": 0,
        "precision": 0,
        "nonConformity": "string",
        "method": "string",
        "frequency": "Hourly",
        "legalCriteria": "string",
        "controlPhaseId": "37ec2261-cfb8-480d-baa4-29feed17ff38",
        "acceptedPhotoFileIds": [
          "497f6eca-6276-4993-bfeb-53cbbbba6f08"
        ],
        "rejectedPhotoFileIds": [
          "497f6eca-6276-4993-bfeb-53cbbbba6f08"
        ]
      }
    ],
    "suppliers": [
      {
        "name": "string",
        "internalCode": "string",
        "origins": [
          {
            "originTypeId": "6111779f-6cec-486d-85bf-2e8ed2686050",
            "marketId": "4e934bc8-bf09-4970-9252-7ebc32247830",
            "countryId": "bd2b151e-bbbf-43a3-8058-286e653dfac0",
            "regionId": "a29f01e1-8a8d-451e-b685-f8b0b4ec4767",
            "zoneId": "c3920607-5069-4ac3-ba10-00754e7a8e8b",
            "fishingZoneIds": [
              "497f6eca-6276-4993-bfeb-53cbbbba6f08"
            ],
            "fishingGearIds": [
              "497f6eca-6276-4993-bfeb-53cbbbba6f08"
            ]
          }
        ]
      }
    ],
    "sampleStorage": {
      "storageConditionTemperatureId": "711b146f-39be-4e0c-bfff-e4f9fd631959",
      "temperatureUnitOfMeasureId": "65d208c6-bfd0-448c-b9a1-80fc4acff2c4",
      "minimumTemperature": 0,
      "maximumTemperature": 0,
      "minimumHumidity": 0,
      "maximumHumidity": 0,
      "keepAwayFromLight": true,
      "size": "string",
      "duration": "string"
    },
    "controlPlans": [
      {
        "characteristicId": "1df5b437-b149-405c-a522-314a29cc1d0d",
        "controlType": "string",
        "method": "string",
        "madeBy": "string",
        "frequency": "Every batch",
        "batchLotSize": "string",
        "sampleSize": "string",
        "criticity": "string",
        "precision": "string",
        "release": true,
        "registered": true
      }
    ],
    "certificateIds": [
      "497f6eca-6276-4993-bfeb-53cbbbba6f08"
    ],
    "attachmentFileIds": [
      "497f6eca-6276-4993-bfeb-53cbbbba6f08"
    ]
  }'

Réponses

The flavor was created and published

Corpsapplication/json
materialIdstring, (uuid)
Réponse
{ "materialId": "30cdab3c-3e2b-44f4-8415-c6dd88ed4261" }