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
62 changes: 62 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6473,10 +6473,15 @@ paths:
child_title:
type: string
description: The second side, e.g. Child
counts_as_household:
type: boolean
default: false
description: Whether Contacts linked by this category count as one household
example:
charity_id: 12
parent_title: Parent
child_title: Child
counts_as_household: true
responses:
"201":
description: The Relationship Category made
Expand Down Expand Up @@ -6505,6 +6510,58 @@ paths:
example:
errors: ["Already exists"]
existing_id: 34
/relationship_categories/{id}:
patch:
tags: [Beneficiaries]
summary: Update a Relationship Category
description: |
Changes a kind of relationship's two titles, or whether it counts as a household, as Edit
on the organisation's Relationship Types page does. Mark the family relationships an
organisation uses (e.g. Parent & Child, Partner & Partner) with `counts_as_household`, and
Contacts linked by them, directly or through other Contacts, are counted as one household.
Households are recalculated in the background within a few minutes.

Only organisation editors (Organisation Admins) may change them (`403` otherwise). Send
only the fields to change.
operationId: updateRelationshipCategory
security: [{tokenAuth: []}]
parameters:
- name: id
in: path
required: true
schema: { type: integer }
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
parent_title:
type: string
description: The new first side
child_title:
type: string
description: The new second side
counts_as_household:
type: boolean
description: Whether Contacts linked by this category count as one household
example:
counts_as_household: true
responses:
"200":
description: The Relationship Category as changed
content:
application/json:
schema: { $ref: '#/components/schemas/RelationshipCategory' }
"401":
$ref: '#/components/responses/Unauthorized'
"403":
$ref: '#/components/responses/ForbiddenError'
"404":
$ref: '#/components/responses/NotFound'
"422":
$ref: '#/components/responses/UnprocessableEntityList'
/audiences:
get:
tags: [Beneficiaries]
Expand Down Expand Up @@ -29781,6 +29838,11 @@ components:
child_title:
type: string
description: The second side, e.g. Pupil
counts_as_household:
type: boolean
description: |
Whether Contacts linked by this category, directly or through other Contacts, are
counted as one household (family), e.g. Parent & Child or Partner & Partner
created_at: { type: string, format: date-time }
updated_at: { type: string, format: date-time }

Expand Down
19 changes: 16 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2152,21 +2152,34 @@ function buildDocsPage() {
{ name: "per_page", in: "query", type: "integer", required: false, desc: "Default 10, max 200" },
{ name: "last_synced_datetime", in: "query", type: "string", required: false, desc: "Only categories changed since then" }
], [
{ code: "200", cls: "response-2xx", desc: "<code>data</code>: each category's <code>id</code>, <code>parent_title</code> and <code>child_title</code> (e.g. School and Pupil), in the paginated envelope" },
{ code: "200", cls: "response-2xx", desc: "<code>data</code>: each category's <code>id</code>, <code>parent_title</code> and <code>child_title</code> (e.g. School and Pupil), and <code>counts_as_household</code>, in the paginated envelope" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "404", cls: "response-4xx", desc: "An organisation you aren't in" }
], "The kinds of relationship Contacts can have with each other in the organisation. Any member of the organisation can list them.")}
${endpointCard("POST", "/relationship_categories", "Create a Relationship Category", true, [
{ name: "charity_id", in: "body", type: "integer", required: false, desc: "The organisation. Optional if you belong to only one" },
{ name: "parent_title", in: "body", type: "string", required: true, desc: "The first side, e.g. Parent" },
{ name: "child_title", in: "body", type: "string", required: true, desc: "The second side, e.g. Child" }
{ name: "child_title", in: "body", type: "string", required: true, desc: "The second side, e.g. Child" },
{ name: "counts_as_household", in: "body", type: "boolean", required: false, desc: "Whether Contacts linked by it count as one household. Default false" }
], [
{ code: "201", cls: "response-2xx", desc: "The category made: <code>id</code>, <code>parent_title</code>, <code>child_title</code>" },
{ code: "201", cls: "response-2xx", desc: "The category made: <code>id</code>, <code>parent_title</code>, <code>child_title</code>, <code>counts_as_household</code>" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "403", cls: "response-4xx", desc: "You aren't an organisation editor (Organisation Admin)" },
{ code: "404", cls: "response-4xx", desc: "An organisation you aren't in" },
{ code: "422", cls: "response-4xx", desc: "A title is missing, or the pair already exists in any case: <code>existing_id</code> is the one already there, to reuse" }
], "<strong>New Relationship Type</strong> on the organisation's Relationship Types page, e.g. Parent &amp; Child or Client &amp; Emergency Contact. A fixed Signup Page needs one to connect the people it signs up. List them first and reuse one that fits.")}
${endpointCard("PATCH", "/relationship_categories/{id}", "Update a Relationship Category", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "The Relationship Category" },
{ name: "parent_title", in: "body", type: "string", required: false, desc: "The new first side" },
{ name: "child_title", in: "body", type: "string", required: false, desc: "The new second side" },
{ name: "counts_as_household", in: "body", type: "boolean", required: false, desc: "Whether Contacts linked by it count as one household" }
], [
{ code: "200", cls: "response-2xx", desc: "The category as changed: <code>id</code>, <code>parent_title</code>, <code>child_title</code>, <code>counts_as_household</code>" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "403", cls: "response-4xx", desc: "You aren't an organisation editor (Organisation Admin)" },
{ code: "404", cls: "response-4xx", desc: "A category in an organisation you aren't in" },
{ code: "422", cls: "response-4xx", desc: "A title is blank, or the new pair already exists" }
], "<strong>Edit</strong> on the organisation's Relationship Types page. Tick <strong>Counts as a household</strong> for family relationships such as Parent &amp; Child: Contacts linked by them, directly or through other Contacts, are then counted as one household. Households are recalculated in the background within a few minutes.")}
${endpointCard("GET", "/audiences", "List the organisation's audiences", true, [
{ name: "charity_id", in: "query", type: "integer", required: false, desc: "The organisation. Optional if you belong to only one" },
{ name: "page", in: "query", type: "integer", required: false, desc: "Page number" },
Expand Down
Loading