Skip to content

Designed
Replace a chapter's documents

Request

Full replace of the documents attached to one chapter of the specification. Files are uploaded beforehand through the document API and referenced by id. An id the list does not carry is detached (the file itself stays in the document API); an id it carries that is not attached yet is attached; [] detaches them all.

Anyone who can update the specification may change its documents, on the retailer side or the supplier side.

Refused with a 422 naming fileIds: an unknown file; a file owned by a company other than the specification's owner or supplier; a file type the chapter does not accept; a file already attached to another chapter of the specification (detach it there first); the same file twice; a file 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 the chapter's documents.

Security
oauth2(Required scopes: t1_api)
Path
specificationIdstring, (uuid)required

The unique identifier of the specification

chapterTypestringrequired

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.

Bodyapplication/jsonrequired
fileIdsArray of strings, (uuid)required

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

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

Responses

The chapter's documents were replaced

Response
No content