funder, trustees, local_authority (Commissioner or contract), corporate_partner, internal" },
{ name: "theme", type: "string", required: false, desc: "children_and_young_people, community, employment, governance, health_and_wellbeing, volunteering" },
- { name: "output", type: "string", required: false, desc: "Answer formats any of its questions ask for: narrative, number, chart" },
+ { name: "output", type: "string", required: false, desc: "Answer formats any of its questions ask for: narrative, number, chart, table" },
{ name: "sort", type: "string", required: false, desc: "added (in the most organisations' libraries first, default), new or az" },
{ name: "page", type: "integer", required: false, desc: "Page number" },
{ name: "per_page", type: "integer", required: false, desc: "Report Templates per page (default 10, max 200)" },
@@ -3246,6 +3248,93 @@ function buildDocsPage() {
+
+ A Report Template is the list of questions a report has to answer, for Makerble® ReportMaker™. Each question says what kind of answer it needs in expected_output_types: any of narrative, number, chart and table.
output_settings holds each output's settings: word_limit for a Narrative the recipient limits (e.g. "max 250 words"), and for a Table, table with columns (each a heading and a type of text or number), row_mode (reporter_adds or fixed) and, for fixed rows, fixed_row_labels. With fixed rows the first column holds the labels.
id, charity_id, name, description, recipient_type, theme, updated_at and questions (id, question_title, guidance_notes, nuance, position, expected_output_types, output_settings)" },
+ { code: "404", cls: "response-4xx", desc: "An organisation you can't see Report Templates in" },
+ { code: "422", cls: "response-4xx", desc: "No charity_id" }
+ ])}
+ ${endpointCard("GET", "/report_templates/{id}", "Get a Report Template", true, [
+ { name: "id", in: "path", type: "integer", required: true, desc: "The Report Template" }
+ ], [
+ { code: "200", cls: "response-2xx", desc: "The Report Template as above, in data" },
+ { code: "404", cls: "response-4xx", desc: "Not found, or one you can't see" }
+ ])}
+ ${endpointCard("POST", "/report_templates", "Create a Report Template", true, [
+ { name: "charity_id", in: "body", type: "integer", required: true, desc: "The organisation" },
+ { name: "name", in: "body", type: "string", required: true, desc: "e.g. the funder and the report name" },
+ { name: "description", in: "body", type: "string", required: false, desc: "Who the report is for and when it's used" },
+ { name: "recipient_type", in: "body", type: "string", required: false, desc: "funder, trustees, local_authority, corporate_partner or internal" },
+ { name: "theme", in: "body", type: "string", required: false, desc: "children_and_young_people, community, employment, governance, health_and_wellbeing or volunteering" },
+ { name: "questions", in: "body", type: "array", required: false, desc: "In order, each with question_title, guidance_notes, nuance, expected_output_types and output_settings" }
+ ], [
+ { code: "201", cls: "response-2xx", desc: "The new Report Template, in data" },
+ { code: "404", cls: "response-4xx", desc: "An organisation you can't create Report Templates in" },
+ { code: "422", cls: "response-4xx", desc: "errors naming the question, e.g. Question 1: Table needs at least one column" }
+ ])}
+ ${endpointCard("PATCH", "/report_templates/{id}", "Change a Report Template", true, [
+ { name: "id", in: "path", type: "integer", required: true, desc: "The Report Template" },
+ { name: "questions", in: "body", type: "array", required: false, desc: "Give an existing question's id to change it; questions without one are added; {id, _destroy: true} removes one" }
+ ], [
+ { code: "200", cls: "response-2xx", desc: "The changed Report Template, in data" },
+ { code: "403", cls: "response-4xx", desc: "Not its creator or an Organisation Admin, or it is approved for the ImpactStore" },
+ { code: "404", cls: "response-4xx", desc: "Not found, or one you can't see" },
+ { code: "422", cls: "response-4xx", desc: "errors" }
+ ], "Fields left out stay as they are.")}
+ A Report's answers (Report Contents), one per question of its Report Template, as Write the Content shows them. A Table answer is table_rows: one array of cells per row, in the order of the template's columns.
question_id, question_title, expected_output_types, output_settings, narrative_content, number_content, word_count, words_over_limit, table_columns, table_rows, table_changed_in_template, ai_status, data_gaps and updated_at" },
+ { code: "404", cls: "response-4xx", desc: "A Report you can't see" }
+ ])}
+ ${endpointCard("GET", "/reports/{report_id}/contents/{question_id}", "Get a Report's answer to one question", true, [
+ { name: "report_id", in: "path", type: "integer", required: true, desc: "The Report" },
+ { name: "question_id", in: "path", type: "integer", required: true, desc: "A question of the Report's Report Template" }
+ ], [
+ { code: "200", cls: "response-2xx", desc: "The answer as above, in data" },
+ { code: "404", cls: "response-4xx", desc: "A Report you can't see, or a question from another template" }
+ ])}
+ ${endpointCard("PATCH", "/reports/{report_id}/contents/{question_id}", "Write a Report's answer to one question", true, [
+ { name: "report_id", in: "path", type: "integer", required: true, desc: "The Report" },
+ { name: "question_id", in: "path", type: "integer", required: true, desc: "A question of the Report's Report Template" },
+ { name: "narrative_content", in: "body", type: "string", required: false, desc: "HTML, as the rich text editor saves it" },
+ { name: "number_content", in: "body", type: "number", required: false, desc: "The figure" },
+ { name: "table_rows", in: "body", type: "array", required: false, desc: "Replaces the whole table. Cells beyond the columns and empty rows are dropped; a Number column's cells must be numbers; with fixed rows the first cell of each row is the template's label" }
+ ], [
+ { code: "200", cls: "response-2xx", desc: "The saved answer, in data. A Narrative over its word limit is saved, with words_over_limit saying by how much" },
+ { code: "403", cls: "response-4xx", desc: "Not a Report Editor, Report Reporter or Organisation Admin" },
+ { code: "404", cls: "response-4xx", desc: "A Report you can't see, or a question from another template" },
+ { code: "422", cls: "response-4xx", desc: "errors, e.g. Row 1: Target must be a number" }
+ ])}
+