Passer au contenu

Limited
Create library made composite

Requête

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

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.

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.

characteristicsArray of objects or null(MaterialCharacteristicWrite)
controlPlansArray of objects or null(MaterialControlPlanWrite)
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.

ingredientsArray of objects or null(MaterialIngredientWrite)
curl -i -X POST \
  https://apis.traceone.com/spec/v2/library/materials/made-composites \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "string",
    "internalCode": "string",
    "commercialName": "string",
    "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"
    },
    "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"
        ]
      }
    ],
    "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
      }
    ],
    "attachmentFileIds": [
      "497f6eca-6276-4993-bfeb-53cbbbba6f08"
    ],
    "ingredients": [
      {
        "materialId": "30cdab3c-3e2b-44f4-8415-c6dd88ed4261",
        "percentage": 0,
        "minPercentage": 0,
        "maxPercentage": 0,
        "functionId": "88c30c0d-0919-4072-a552-9669be152724"
      }
    ]
  }'

Réponses

The made composite was created and published

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