Skip to content

Limited
Create library testing chapter

Request

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

One testing chapter object for every template type (same content, decision D-09). The template type in the path is the family of specifications that can link the chapter: a packaging specification links only a packaging chapter, a food specification only a food one. A new template type is a new value of templateType, not a new route.

Security
oauth2(Required scopes: t1_api)
Path
templateTypestringrequired

The template type of the library chapter: the family of specifications that can link it. A value outside the list is a 404; so is a chapter of another template type.

Enum:"food""packaging"
Bodyapplication/jsonrequired
namestringrequired

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

characteristicsArray of objects or null(Characteristic)

Replaces the characteristics table in full. A row whose characteristicId is absent from the array is removed; a row carrying one updates it; a row without one is added. null or absent leaves the table unchanged; send [] to clear it.

controlPlansArray of objects or null(ControlPlan)

Same replace rule, keyed on characteristicId. Each row must name a characteristicId present in the characteristics table whose controlPhaseId is set - otherwise a 422 naming the entry.

curl -i -X POST \
  'https://apis.traceone.com/spec/v2/library/{templateType}/testing-chapters' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "string",
    "characteristics": [
      {
        "characteristicId": "1df5b437-b149-405c-a522-314a29cc1d0d",
        "libraryCharacteristicId": "c199d322-c3f0-481d-8ab8-f020c457ae1e",
        "typeId": "caab7c42-4ce7-4bd5-bbab-6017cec730b7",
        "name": "pH level",
        "controlPhaseId": "37ec2261-cfb8-480d-baa4-29feed17ff38",
        "method": "string",
        "frequency": "Every batch",
        "legalCriteria": "string",
        "target": "4.0 - 4.5",
        "tolerance": "string",
        "lowerTarget": "string",
        "upperTarget": "string",
        "lowerTolerance": "string",
        "upperTolerance": "string",
        "precision": "string",
        "nonConformity": "string",
        "quantity": 0,
        "unitOfMeasureId": "fd215922-b7a3-49a8-9803-63113a404f96",
        "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
      }
    ]
  }'

Responses

The chapter was created and published

Bodyapplication/json
chapterIdstring, (uuid)
Response
{ "chapterId": "2a48aff7-27e7-4ab6-9471-1ee9c5632811" }