Passer au contenu

Limited
Replace library testing chapter

Requête

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.

Sécurité
oauth2(Portées requises: t1_api)
Chemin
templateTypestringobligatoire

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"
chapterIdstring, (uuid)obligatoire

The unique identifier of the library chapter

En-têtes
If-Matchstring

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

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

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 PUT \
  'https://apis.traceone.com/spec/v2/library/{templateType}/testing-chapters/{chapterId}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -H 'If-Match: string' \
  -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
      }
    ]
  }'

Réponses

The chapter was replaced in place (active version). Read it back, with its new ETag, from the chapter GET.

Réponse
Aucun contenu