Passer au contenu

Limited
Get the answers schema (design time)

Requête

Returns the JSON Schema that answer documents for this template must satisfy. This is the design-time contract for the answers write: fetch it once per template, bake the mapping into the integration, and send answer documents that validate against it. One schema per template — hundreds of templates scale without per-template DTOs. A published template never changes, so neither does its schema.

The schema is a JSON Schema draft-07 document projected from the stored one:

  • properties are keyed by question code (QuestionnaireQuestion.code: generated names question1, question2, … stable for the published template — map them through questionId or text of the template GET, not by guessing);
  • a question other questions depend on sits with its dependants in a condition object (condition1, …) whose draft-07 dependencies / oneOf branches carry the dependants per parent answer;
  • a choice question carries enum of its option codes (items.enum for multi-choice);
  • the root has additionalProperties false: a key that is not a question or condition code is refused;
  • the schema declares no required keyword: which questions must be answered for the questionnaire to validate is QuestionnaireQuestion.required (and dependsOn) of the template GET. Mandatory answers are not checked on write;
  • internal keywords of the stored schema are not exposed. The dialect stays draft-07 (dependencies is a draft-07 keyword); a newer dialect would only ever be offered as an opt-in.
Sécurité
oauth2(Portées requises: t1_api)
Chemin
questionnaireTemplateIdstring, (uuid)obligatoire

The unique identifier of the questionnaire template

curl -i -X GET \
  'https://apis.traceone.com/spec/v2/questionnaire-templates/{questionnaireTemplateId}/answers-schema' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>'

Réponses

Returns the JSON Schema for this template's answers

Corpsapplication/json
object

A JSON Schema document (draft-07)

Réponse
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "question1": { … }, "condition1": { … } } }