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
48 changes: 48 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2479,6 +2479,13 @@ paths:
Lists the personal survey links already generated for a Survey Campaign, e.g. to
reuse a Contact's existing link. A `use_once` link that has been answered has
`expired: true`. Requires Project Editor or Organisation Editor access.

Each link's `responses_in_progress` lists the survey responses the Contact has
started on it but not finished (saved with Finish Later), newest first. This is the
**Surveys in progress** column on the Survey Campaign's Response Rates tab. Pass
`in_progress=true` to list only links with one. Unfinished responses are kept for 30
days after they were last updated. Saving one doesn't change the link's `updated_at`,
so `last_synced_datetime` doesn't pick it up.
operationId: listSurveyLinks
security: [{tokenAuth: []}]
parameters:
Expand All @@ -2495,13 +2502,39 @@ paths:
schema:
type: integer
description: Only links for this Wave
- name: in_progress
in: query
schema:
type: boolean
description: "`true`: only links where the Contact has started a response but not finished it"
responses:
"200":
description: Paginated list
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedSurveyLinks'
example:
page: 1
page_size: 1
page_count: 1
total_count: 1
data:
- id: 812
send_survey_id: 340
beneficiary_id: 5521
email: sam@example.org
survey_token: 0f8c1d2e3b4a59687a6b5c4d3e2f1a0b
survey_url: https://app.makerble.com/stories/new/0f8c1d2e3b4a59687a6b5c4d3e2f1a0b
link_expiry: use_once
is_anonymised: false
send_survey_wave_id: 12
expired: false
created_at: "2026-10-01T09:00:00Z"
updated_at: "2026-10-01T09:00:00Z"
responses_in_progress:
- send_survey_wave_id: 12
last_updated_at: "2026-10-03T14:30:00Z"
"401":
$ref: '#/components/responses/Unauthorized'
"403":
Expand Down Expand Up @@ -15755,6 +15788,21 @@ components:
updated_at:
type: string
format: date-time
responses_in_progress:
type: array
description: |
Survey responses the Contact has started on this link but not finished (saved with
Finish Later), newest first; empty when there are none. Only those updated in the
last 30 days. Not counted as completed responses.
items:
type: object
properties:
send_survey_wave_id:
type: integer
nullable: true
last_updated_at:
type: string
format: date-time

SurveyWave:
type: object
Expand Down
5 changes: 3 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1681,14 +1681,15 @@ function buildDocsPage() {
{ name: "id", in: "path", type: "integer", required: true, desc: "Survey Campaign (Project Story Category) ID" },
{ name: "beneficiary_id", type: "integer", required: false, desc: "Only this Contact's links" },
{ name: "send_survey_wave_id", type: "integer", required: false, desc: "Only links for this Wave" },
{ name: "in_progress", type: "boolean", required: false, desc: "<code>true</code>: only links where the Contact has started a response but not finished it" },
{ name: "page", type: "integer", required: false, desc: "Page number" },
{ name: "per_page", type: "integer", required: false, desc: "Records per page (max 200)" },
{ name: "last_sync_datetime", type: "string", required: false, desc: "ISO 8601 incremental sync" }
], [
{ code: "200", cls: "response-2xx", desc: "Paginated list of links" },
{ code: "200", cls: "response-2xx", desc: "Paginated list of links, each with <code>responses_in_progress</code>: <code>[{send_survey_wave_id, last_updated_at}]</code>, newest first" },
{ code: "403", cls: "response-4xx", desc: "Not a Project Editor or Organisation Editor" },
{ code: "404", cls: "response-4xx", desc: "Survey Campaign not found" }
], "Use it to reuse a Contact's existing link. A <code>use_once</code> link that has been answered has <code>expired: true</code>.")}
], "Use it to reuse a Contact's existing link. A <code>use_once</code> link that has been answered has <code>expired: true</code>. <code>responses_in_progress</code> lists the responses the Contact started on the link but hasn't finished (the <strong>Surveys in progress</strong> column on the Response Rates tab); they're kept for 30 days after they were last updated.")}
</div>
</section>

Expand Down
Loading