From 59ecdb0e2b76f4003c3b77f2430e4014eeec2521 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 5 Nov 2026 19:06:55 +0000 Subject: [PATCH] Document Video, Audio and Picture fields for POST /fields CP-7996: field_data_type accepts video, audio and picture, which make an Attachment field that asks for that kind of media; responses carry capture_type. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01F1a5xqgTaL1hwuttt8eotF --- openapi.yaml | 37 ++++++++++++++++++++++++++++++------- server.js | 2 +- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 76bf8ea..a61600f 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -2273,7 +2273,10 @@ paths: get: tags: [Beneficiary Categories] summary: List Custom Field definitions (Contact Bio Forms) - description: Filter by `beneficiary_category_ids[]` to get fields for specific forms. + description: | + Filter by `beneficiary_category_ids[]` to get fields for specific forms. Each field's + `capture_type` is `video`, `audio` or `picture` for a Video, Audio or Picture question (an + Attachment field, `field_data_type: file`, that asks for that kind of media), otherwise null. operationId: listCustomFields security: [{tokenAuth: []}] parameters: @@ -6738,7 +6741,8 @@ paths: `activity_trackers` and `metrics`. - **toolkit**: `description` and `contents`, each with `type`, `id` and `name`. - **activity_tracker**: `description`, `instruction`. **outcome**: `description`, `metrics`. - **unit**: `alignment`. **field**: `field_type`. **project_type**: `strapline`, + **unit**: `alignment`. **field**: `field_type`, and `capture_type` (`video`, `audio` or + `picture`) for a Video, Audio or Picture question. **project_type**: `strapline`, `description`. **idea**: `description`. Linked Outcomes and Metrics are named only when you may see them. An item you may not see @@ -7005,6 +7009,13 @@ paths: Field is a heading with `section_text` under it; it isn't listed in the library, so the response has only its `id`, `type`, `name` and `approved`. Fields are never shared in the public library. Near-identical names get `409`, as for **Create a List**. + + **Video, Audio and Picture questions.** `video`, `audio` and `picture` create a Video, Audio + or Picture question for a Survey (Story Category): an Attachment Field that asks for that kind + of media, which the person answering can record or take there and then with their camera or + microphone, or attach from their device. It is stored and returned as `field_type: file` with + `capture_type` set to `video`, `audio` or `picture`, and its answers are uploaded files like any + other Attachment answer. security: [{tokenAuth: []}] requestBody: required: true @@ -7021,7 +7032,10 @@ paths: type: string field_data_type: type: string - enum: [text, number, date, time, file, section_title, email_address, telephone, signature] + enum: [text, number, date, time, file, video, audio, picture, section_title, email_address, telephone, signature] + description: | + The kind of answer. `file` is an Attachment for any file; `video`, `audio` and + `picture` ask for that kind of media (see above). section_text: type: string description: For a section_title Field only @@ -7030,10 +7044,19 @@ paths: description: True if only the organisation's staff may see the answers force: $ref: '#/components/schemas/ForceCreate' - example: - organisation_id: 913 - field_name: "Postcode" - field_data_type: text + examples: + text: + summary: A text Field + value: + organisation_id: 913 + field_name: "Postcode" + field_data_type: text + video: + summary: A Video question + value: + organisation_id: 913 + field_name: "Record a short video telling us what you learnt today" + field_data_type: video responses: "201": $ref: '#/components/responses/LibraryItemCreated' diff --git a/server.js b/server.js index 916806a..819e88f 100644 --- a/server.js +++ b/server.js @@ -2221,7 +2221,7 @@ function buildDocsPage() { ${endpointCard("POST", "/fields", "Create a Field", true, [ { name: "organisation_id", in: "body", type: "integer", required: true, desc: "The organisation (Charity) that will own it; you must be one of its editors" }, { name: "field_name", in: "body", type: "string", required: true, desc: "The question, e.g. Date of birth" }, - { name: "field_data_type", in: "body", type: "string", required: true, desc: "text, number, date, time, file, section_title, email_address or telephone" }, + { name: "field_data_type", in: "body", type: "string", required: true, desc: "text, number, date, time, file, video, audio, picture, section_title, email_address, telephone or signature. video, audio and picture make a Video, Audio or Picture question: an Attachment that asks for that kind of media, which people can record or take in the survey. It is returned with field_type: file and capture_type" }, { name: "section_text", in: "body", type: "string", required: false, desc: "For a section_title Field only" }, { name: "private", in: "body", type: "boolean", required: false, desc: "Only the organisation's staff may see the answers" }, { name: "force", in: "body", type: "boolean", required: false, desc: "true to create it even though a near-identical one exists (see 409)" }