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
140 changes: 140 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7563,6 +7563,146 @@ paths:
"401":
$ref: '#/components/responses/Unauthorized'

/stories/search:
get:
tags: [Stories]
summary: Search Stories by keyword, Label or Outcome
description: |
Searches the text of the Stories and survey responses you can see, and their written answers to Survey
questions, and returns a short snippet of each match. Search by `query` (keywords or a phrase; word forms
match, so "confident" finds "confidence"), by `label_ids` (Stories carrying any of these Labels), or by
`outcome_id` (Stories carrying a Label linked to that Outcome). Give at least one of the three. With a
query, results are ordered by relevance; without one, newest first. Contacts' names in snippets are
replaced with "[name]". `total_count` stops at 1000, and `total_count_capped` is then true. Label ids that
aren't your organisations' are ignored and listed in `ignored_label_ids`.
operationId: searchStories
security: [{tokenAuth: []}]
parameters:
- $ref: '#/components/parameters/Page'
- name: per_page
in: query
description: Default 10, at most 25
schema: { type: integer, default: 10, maximum: 25 }
- name: query
in: query
description: Keywords or a phrase
schema: { type: string }
example: found a job
- name: label_ids[]
in: query
description: Only Stories carrying any of these Labels
schema: { type: array, items: { type: integer } }
- name: outcome_id
in: query
description: Only Stories carrying a Label linked to this Outcome
schema: { type: integer }
- name: project_ids[]
in: query
description: Only these projects; by default every project you can see
schema: { type: array, items: { type: integer } }
- name: story_category_id
in: query
description: Only Stories of this Survey (Story Category)
schema: { type: integer }
- name: start_date
in: query
description: Earliest Story date, YYYY-MM-DD
schema: { type: string, format: date }
- name: end_date
in: query
description: Latest Story date, YYYY-MM-DD
schema: { type: string, format: date }
responses:
"200":
description: A page of matching Stories with snippets
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/PaginationEnvelope'
- type: object
properties:
total_count_capped: { type: boolean, description: True when more than 1000 Stories match }
ignored_label_ids: { type: array, items: { type: integer } }
data:
type: array
items:
type: object
properties:
story_id: { type: integer }
story_category: { type: string, description: The Survey's name }
project: { type: string }
created_at: { type: string, format: date }
labels: { type: array, items: { type: string } }
snippet: { type: string, description: "Up to 300 characters, with Contacts' names replaced by [name]" }
example:
page: 1
page_size: 1
page_count: 1
total_count: 1
total_count_capped: false
ignored_label_ids: []
data:
- story_id: 1234
story_category: Exit survey
project: Into work
created_at: "2026-03-10"
labels: [Found work]
snippet: "[name] found a job at the bakery after six weeks of mentoring."
"401":
$ref: '#/components/responses/Unauthorized'
"422":
$ref: '#/components/responses/UnprocessableEntity'
/stories/search_labels:
get:
tags: [Stories]
summary: List the Labels used on Stories, with counts
description: |
The Labels carried by the Stories you can see in the given projects and dates, with how many Stories carry
each and the Outcomes each is linked to. Labels no Story there carries are left out. Use the ids with
GET /stories/search.
operationId: listStorySearchLabels
security: [{tokenAuth: []}]
parameters:
- name: project_ids[]
in: query
description: Only these projects; by default every project you can see
schema: { type: array, items: { type: integer } }
- name: start_date
in: query
description: Earliest Story date, YYYY-MM-DD
schema: { type: string, format: date }
- name: end_date
in: query
description: Latest Story date, YYYY-MM-DD
schema: { type: string, format: date }
responses:
"200":
description: The Labels in use, by name
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
type: object
properties:
id: { type: integer }
name: { type: string }
stories_in_scope: { type: integer }
outcomes:
type: array
items:
type: object
properties:
id: { type: integer }
title: { type: string }
"401":
$ref: '#/components/responses/Unauthorized'
"422":
$ref: '#/components/responses/UnprocessableEntity'
/story_categories:
get:
tags: [Story Categories]
Expand Down
23 changes: 23 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,29 @@ function buildDocsPage() {
{ name: "start_date", type: "string", required: false, desc: "YYYY-MM-DD — stories on or after this date" },
{ name: "end_date", type: "string", required: false, desc: "YYYY-MM-DD — stories on or before this date" }
], [{ code: "200", cls: "response-2xx", desc: "Stories enriched with named Indicators, Changes, and Custom Field values — ideal for reporting" }])}
${endpointCard("GET", "/stories/search", "Search Stories by keyword, Label or Outcome", true, [
{ name: "query", in: "query", type: "string", required: false, desc: "Keywords or a phrase; word forms match" },
{ name: "label_ids[]", in: "query", type: "integer[]", required: false, desc: "Only Stories carrying any of these Labels" },
{ name: "outcome_id", in: "query", type: "integer", required: false, desc: "Only Stories carrying a Label linked to this Outcome" },
{ name: "project_ids[]", in: "query", type: "integer[]", required: false, desc: "Only these projects; by default every project you can see" },
{ name: "story_category_id", in: "query", type: "integer", required: false, desc: "Only Stories of this Survey" },
{ name: "start_date", in: "query", type: "string", required: false, desc: "YYYY-MM-DD" },
{ name: "end_date", in: "query", type: "string", required: false, desc: "YYYY-MM-DD" },
{ name: "page", in: "query", type: "integer", required: false, desc: "Page number" },
{ name: "per_page", in: "query", type: "integer", required: false, desc: "Default 10, max 25" }
], [
{ code: "200", cls: "response-2xx", desc: "<code>data</code>: each match's <code>story_id</code>, <code>story_category</code>, <code>project</code>, <code>created_at</code>, <code>labels</code> and <code>snippet</code>, in the paginated envelope, plus <code>total_count_capped</code> and <code>ignored_label_ids</code>" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "422", cls: "response-4xx", desc: "None of query, label_ids or outcome_id, a date not in YYYY-MM-DD, or per_page over 25" }
], "Give at least one of <code>query</code>, <code>label_ids</code> or <code>outcome_id</code>. Searches Story text and written Survey answers; snippets are up to 300 characters with Contacts' names replaced by <code>[name]</code>. With a query, results are ordered by relevance; without one, newest first. <code>total_count</code> stops at 1000.")}
${endpointCard("GET", "/stories/search_labels", "List the Labels used on Stories, with counts", true, [
{ name: "project_ids[]", in: "query", type: "integer[]", required: false, desc: "Only these projects; by default every project you can see" },
{ name: "start_date", in: "query", type: "string", required: false, desc: "YYYY-MM-DD" },
{ name: "end_date", in: "query", type: "string", required: false, desc: "YYYY-MM-DD" }
], [
{ code: "200", cls: "response-2xx", desc: "<code>data</code>: each Label's <code>id</code>, <code>name</code>, <code>stories_in_scope</code> and linked <code>outcomes</code>" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" }
], "Only Labels that Stories in those projects and dates carry. Use the ids with <code>GET /stories/search</code>.")}
${endpointCard("GET", "/stories/{id}/attachments", "Get attachments for a Story", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Story ID" }
], [{ code: "200", cls: "response-2xx", desc: "Paginated media attachments" }])}
Expand Down
Loading