Passer au contenu

Designed
Replace a chapter's requirements

Requête

Full replace of the requirements attached to one chapter of the specification. Requirements are PRE-CREATED library objects of the specification's owner company, referenced by id. An id the list does not carry is detached; an id it carries that is not attached yet is attached; [] detaches them all. Removals are applied before additions, so replacing a requirement by its new version works in one call.

Only a retailer contact of the specification may change its requirements; anyone else is a 403.

Refused with a 422 naming requirementIds: an unknown id; a requirement of another company; a requirement that is not its active version; a requirement already attached to another chapter of the specification (detach it there first); the same requirement twice; a requirement sent for a chapterType the specification does not have. A locked specification is a 422 INVALID_RESOURCE_STATE with no paramName.

Nothing to change is a no-op (204): the list the chapter already carries, also on a locked specification, and [] for a chapterType the specification does not have.

Read the result back on FoodSpecifications_Requirements.

Sécurité
oauth2(Portées requises: t1_api)
Chemin
specificationIdstring, (uuid)obligatoire

The unique identifier of the specification

chapterTypestringobligatoire

Chapter type code of a chapter of the specification, as TemplateStructureChapter.chapterType lists it: general, labelling, production, testing, finishedProduct, or a retailer-defined custom chapter code.

Corpsapplication/jsonobligatoire
requirementIdsArray of strings, (uuid)obligatoire

The requirements the chapter carries after the call; [] detaches them all.

curl -i -X PUT \
  'https://apis.traceone.com/spec/v2/food/specifications/{specificationId}/chapters/{chapterType}/requirements' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "requirementIds": [
      "497f6eca-6276-4993-bfeb-53cbbbba6f08"
    ]
  }'

Réponses

The chapter's requirements were replaced

Réponse
Aucun contenu