Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 164 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ tags:
description: Surveys — form templates used to create Stories
- name: Project Story Categories
description: Survey Campaigns — a Survey assigned to a specific Project
- name: Progress Boards
description: Progress Boards — pages of charts and cards showing a Project's, Album's or Survey's results
- name: Story Metrics
description: Per-story metric records (Story Changes, Story Indicators, Story Beneficiaries)
- name: Changes
Expand Down Expand Up @@ -5641,6 +5643,122 @@ paths:
"422":
$ref: '#/components/responses/UnprocessableEntity'

/progress_boards:
get:
tags: [Progress Boards]
summary: List Progress Boards
description: |
The Progress Boards the Manage Progress Boards page lists for the user: boards they made, are a
Board Admin or Colleague of, or were granted. `archived` boards are hidden from their members
until reopened. `automated_by: Project` marks the boards generated for each Survey on a Project
("<Survey> on <Project>"). `can_archive` says whether the user may archive or reopen the board
(its Board Admins and the person who made it); `can_delete` whether they may delete it (Board
Admins who are Organisation Editors).
operationId: listProgressBoards
security: [{tokenAuth: []}]
parameters:
- $ref: '#/components/parameters/Page'
- $ref: '#/components/parameters/PerPage'
- $ref: '#/components/parameters/LastSyncDatetime'
- name: status
in: query
required: false
schema: {type: string, enum: [open, archived, all], default: all}
description: Which boards to list
responses:
"200":
description: Paginated list of Progress Boards
content:
application/json:
schema:
type: object
properties:
page: {type: integer}
page_size: {type: integer}
page_count: {type: integer}
total_count: {type: integer}
data:
type: array
items:
type: object
properties:
id: {type: integer}
name: {type: string}
slug: {type: string}
charity_id: {type: integer}
board_type: {type: string}
automated_by: {type: string, nullable: true}
automated_by_id: {type: integer, nullable: true}
archived: {type: boolean}
can_archive: {type: boolean}
can_delete: {type: boolean}
created_at: {type: string, format: date-time}
updated_at: {type: string, format: date-time}
"401":
$ref: '#/components/responses/Unauthorized'
"422":
$ref: '#/components/responses/UnprocessableEntity'

/progress_boards/bulk_action:
post:
tags: [Progress Boards]
summary: Archive, reopen or delete several Progress Boards
description: |
Archives, reopens or deletes several Progress Boards at once, as the Archive, Reopen and Delete
buttons do for the boards ticked in the Rows view of the Manage Progress Boards page. Archiving
hides a board until it is reopened, and keeps it archived if its Project is later reopened.
Delete is permanent.

Each board is changed only if the user may: archive and reopen need a Board Admin or the board's
creator; delete needs a Board Admin who is an Organisation Editor. Boards the user may not
change, or can't see, are listed in `skipped` with the reason; the rest still change. At most
100 boards at a time.
operationId: bulkActionProgressBoards
security: [{tokenAuth: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [bulk_action, progress_board_ids]
properties:
bulk_action: {type: string, enum: [archive, reopen, delete]}
progress_board_ids:
type: array
items: {type: integer}
minItems: 1
maxItems: 100
example: {bulk_action: archive, progress_board_ids: [301, 302]}
responses:
"200":
description: What changed and what was skipped
content:
application/json:
schema:
type: object
properties:
action: {type: string}
updated_ids: {type: array, items: {type: integer}}
skipped:
type: array
items:
type: object
properties:
id: {type: integer}
name: {type: string, nullable: true}
reason: {type: string}
message: {type: string}
example:
action: archive
updated_ids: [301]
skipped: [{id: 302, name: "Youth outcomes", reason: "Only its admins can archive or reopen it"}]
message: "1 Progress Board archived. 1 skipped, as you can't archive it."
"401":
$ref: '#/components/responses/Unauthorized'
"422":
$ref: '#/components/responses/UnprocessableEntity'

/project_story_categories:
get:
tags: [Project Story Categories]
Expand Down Expand Up @@ -5706,6 +5824,52 @@ paths:
"422":
$ref: '#/components/responses/UnprocessableEntity'

delete:
tags: [Project Story Categories]
summary: Remove a Survey from a Project
description: |
Removes a Survey from a Project by deleting its Survey Campaign, as Remove from project does in
the Actions menu of a Survey Campaign page. The Survey stays in the Organisation's library and
can be added to the Project again. The Progress Board created automatically for that Survey on
that Project is deleted too.

Refused with 422 and the reason while anything in the Project depends on the campaign: survey
responses recorded with it in that Project, saved draft responses, Events in the Project that
use it, Survey Invitations sent for it, or it being the Project's default survey. It can then
only be deactivated. Requires Project Editor (Project Manager) or Organisation Editor
(Organisation Admin) access.
operationId: deleteProjectStoryCategory
security: [{tokenAuth: []}]
responses:
"200":
description: The Survey Campaign was removed
content:
application/json:
schema:
type: object
properties:
id: {type: integer}
project_id: {type: integer}
story_category_id: {type: integer}
removed: {type: boolean}
example: {id: 812, project_id: 101, story_category_id: 55, removed: true}
"401":
$ref: '#/components/responses/Unauthorized'
"403":
description: The user may not remove this Survey from the Project
content:
application/json:
schema: {$ref: '#/components/schemas/Error'}
"404":
$ref: '#/components/responses/NotFound'
"422":
description: Something in the Project still depends on the Survey Campaign
content:
application/json:
schema: {$ref: '#/components/schemas/Error'}
example:
error: "This survey can't be removed from Youth Club because survey responses have been recorded with it in this project. You can deactivate it instead."

/project_story_categories/{id}/survey_links:
parameters:
- name: id
Expand Down
36 changes: 36 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,7 @@ function buildDocsPage() {
<a href="#projects" class="nav-link"><span class="nav-method method-GET">GET</span>Projects</a>
<a href="#saved-filters" class="nav-link"><span class="nav-method method-POST">POST</span>Saved Filters</a>
<a href="#albums" class="nav-link"><span class="nav-method method-GET">GET</span>Albums (Portfolios)</a>
<a href="#progress-boards" class="nav-link"><span class="nav-method method-POST">POST</span>Progress Boards</a>
<a href="#signup-pages" class="nav-link"><span class="nav-method method-POST">POST</span>Signup Pages</a>
<a href="#users" class="nav-link"><span class="nav-method method-POST">POST</span>Users</a>
<a href="#teams" class="nav-link"><span class="nav-method method-PATCH">PATCH</span>Teams</a>
Expand Down Expand Up @@ -1382,6 +1383,33 @@ function buildDocsPage() {
</div>
</section>

<!-- Progress Boards -->
<section class="section" id="progress-boards">
<div class="section-eyebrow">Core resource</div>
<h2 class="section-title">Progress Boards</h2>
<div class="section-desc">
<p>A Progress Board is a page of charts and cards showing results. Projects can create one automatically for each Survey added to them ("&lt;Survey&gt; on &lt;Project&gt;", <code>automated_by: Project</code>); deactivating that Survey Campaign archives it. Archiving hides a board from its members until it is reopened.</p>
</div>
<div class="endpoint-list">
${endpointCard("GET", "/progress_boards", "List Progress Boards", true, [
{ name: "status", type: "string", required: false, desc: "<code>open</code>, <code>archived</code> or <code>all</code> (default)" },
{ name: "page", type: "integer", required: false, desc: "Page number (default 1)" },
{ name: "per_page", type: "integer", required: false, desc: "Records per page (default 10, max 200)" },
{ name: "last_synced_datetime", type: "string", required: false, desc: "Only boards changed since this time" }
], [
{ code: "200", cls: "response-2xx", desc: "Paginated boards, each with <code>archived</code>, <code>automated_by</code>, <code>can_archive</code> and <code>can_delete</code>" },
{ code: "422", cls: "response-4xx", desc: "Unknown <code>status</code>" }
], "The boards the Manage Progress Boards page lists for the user: ones they made, are a Board Admin or Colleague of, or were granted.")}
${endpointCard("POST", "/progress_boards/bulk_action", "Archive, reopen or delete several Progress Boards", true, [
{ name: "bulk_action", in: "body", type: "string", required: true, desc: "<code>archive</code>, <code>reopen</code> or <code>delete</code>" },
{ name: "progress_board_ids", in: "body", type: "array", required: true, desc: "Up to 100 board IDs" }
], [
{ code: "200", cls: "response-2xx", desc: "<code>action</code>, <code>updated_ids</code>, <code>skipped</code> (<code>{id, name, reason}</code>) and <code>message</code>" },
{ code: "422", cls: "response-4xx", desc: "Unknown action, no boards, or more than 100" }
], "As the Archive, Reopen and Delete buttons for the boards ticked in the Rows view of Manage Progress Boards. Archive and reopen need a Board Admin or the board's creator; delete needs a Board Admin who is an Organisation Editor, and is permanent. Boards the user may not change are skipped, not refused.")}
</div>
</section>

<!-- Albums -->
<section class="section" id="albums">
<div class="section-eyebrow">Core resource</div>
Expand Down Expand Up @@ -2063,6 +2091,14 @@ function buildDocsPage() {
{ code: "404", cls: "response-4xx", desc: "Survey Campaign not found, or another organisation's" },
{ code: "422", cls: "response-4xx", desc: "<code>force_interval</code> missing or not true/false" }
], "New Survey Campaigns have <code>force_interval: true</code>; existing ones were left at <code>false</code>.")}
${endpointCard("DELETE", "/project_story_categories/{id}", "Remove a Survey from a Project", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Survey Campaign (Project Story Category) ID" }
], [
{ code: "200", cls: "response-2xx", desc: "<code>{id, project_id, story_category_id, removed: true}</code>" },
{ code: "403", cls: "response-4xx", desc: "Not a Project Editor or Organisation Editor" },
{ code: "404", cls: "response-4xx", desc: "Survey Campaign not found, or another organisation's" },
{ code: "422", cls: "response-4xx", desc: "Something in the Project still depends on it; <code>error</code> says what" }
], "As Remove from project on a Survey Campaign page. The Survey stays in the library and its automatically created Progress Board for that Project is deleted. Refused while the Project has survey responses, draft responses, Events or Survey Invitations for it, or it is the Project's default survey: deactivate it instead.")}
${endpointCard("GET", "/project_story_categories/{id}/survey_waves", "List the Waves of a Survey Campaign", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Survey Campaign (Project Story Category) ID" },
{ name: "page", type: "integer", required: false, desc: "Page number" },
Expand Down
Loading