From 5dbd7fc255436f2e45666aee09c100665d6854d3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 29 Nov 2026 13:46:47 +0000 Subject: [PATCH] Document the Financial Values endpoints (CP-9365) openapi.yaml paths and schemas, and the matching endpoint cards. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01F1a5xrFaPn7QNXgYCXnZg2 --- openapi.yaml | 320 +++++++++++++++++++++++++++++++++++++++++++++++++++ server.js | 66 +++++++++++ 2 files changed, 386 insertions(+) diff --git a/openapi.yaml b/openapi.yaml index cc8732a..8dd25f5 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -299,6 +299,8 @@ tags: description: Join table linking Outcomes to Indicators - name: Framework Sets description: Groups of Impact Frameworks (e.g. the SDGs) that organisations report their contribution towards + - name: Financial Values + description: Published money values for outcomes, and the project Metrics they are put against on a project's Financial Value calculator - name: Explore description: The Makerble® ImpactStore™'s Explore pages, with the same search, filters and counts as the app - name: Library @@ -6881,6 +6883,247 @@ paths: "422": $ref: '#/components/responses/UnprocessableEntity' + /financial_values: + get: + tags: [Financial Values] + summary: Search the Financial Values you may use + description: | + The Financial Values you may choose on a project's Financial Value calculator, by name: your own, your + organisations', those shared with you and those shared with everyone. A Financial Value is a published + money value per person for an outcome, e.g. "Moving into work: £1,234 a year", in the currency of its country. + operationId: listFinancialValues + security: [{tokenAuth: []}] + parameters: + - name: search + in: query + required: false + schema: { type: string } + description: Part of the name or code, case-insensitive + - name: category_id + in: query + required: false + schema: { type: integer } + description: Only this Methodology (Financial Value Category) + - name: source_id + in: query + required: false + schema: { type: integer } + description: Only those from this Source + - name: country_id + in: query + required: false + schema: { type: integer } + description: Only those for this country + - name: verified + in: query + required: false + schema: { type: boolean } + description: true for only those Makerble has checked, false for only unchecked ones + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PerPage' + - $ref: '#/components/parameters/LastSyncDatetime' + responses: + "200": + description: A page of Financial Values, by name + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/PaginationEnvelope' + - type: object + properties: + data: + type: array + items: { $ref: '#/components/schemas/FinancialValue' } + "401": + $ref: '#/components/responses/Unauthorized' + "422": + $ref: '#/components/responses/UnprocessableEntity' + post: + tags: [Financial Values] + summary: Create a Financial Value + description: | + Creates a Financial Value, as the Create Financial Value form does. It belongs to the organisation you name, + which you must be an Organisation Admin of, or to you if you name none. category, sources and country are + names that already exist in Makerble. + operationId: createFinancialValue + security: [{tokenAuth: []}] + requestBody: + required: true + content: + application/json: + schema: { $ref: '#/components/schemas/FinancialValueInput' } + example: + name: Moving into work + amount: 1234.5 + year: 2023 + country: United Kingdom + privacy: Organisation colleagues only + organisation_id: 913 + category: Wellbeing valuation + sources: [HACT] + responses: + "201": + description: The new Financial Value + content: + application/json: + schema: { $ref: '#/components/schemas/FinancialValue' } + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "422": + description: Something was wrong, e.g. a country that doesn't exist. existing_id is given when the owner already has a Financial Value with this name. + content: + application/json: + schema: + type: object + properties: + errors: { type: array, items: { type: string } } + existing_id: { type: integer } + example: + errors: ["Country 'Atlantis' not found"] + /financial_values/{id}: + get: + tags: [Financial Values] + summary: Get a Financial Value + description: One Financial Value you may use. Any other reads as not found. + operationId: getFinancialValue + security: [{tokenAuth: []}] + parameters: + - name: id + in: path + required: true + schema: { type: integer } + responses: + "200": + description: The Financial Value + content: + application/json: + schema: { $ref: '#/components/schemas/FinancialValue' } + "401": + $ref: '#/components/responses/Unauthorized' + "404": + $ref: '#/components/responses/NotFound' + /projects/{project_id}/financial_values: + get: + tags: [Financial Values] + summary: List a project's Financial Values + description: | + Which Financial Values a project puts against which of its Metrics on its Financial Value calculator, each + with the Metric's result (quantity) and sub_total, and the totals they come to for each currency, as on the + project's Financial Calculator tile. For Project Managers and Organisation Admins of the project. + operationId: listProjectFinancialValues + security: [{tokenAuth: []}] + parameters: + - name: project_id + in: path + required: true + schema: { type: integer } + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PerPage' + responses: + "200": + description: The project's totals and a page of its attachments + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/PaginationEnvelope' + - type: object + properties: + project_id: { type: integer } + financial_calculator_enabled: { type: boolean, description: Whether the project's Financial Calculator is turned on in its Preferences } + totals: + type: array + items: + type: object + properties: + currency: { type: string, example: GBP } + symbol: { type: string, example: '£' } + amount: { type: string, example: '3702.0' } + data: + type: array + items: { $ref: '#/components/schemas/ProjectFinancialValue' } + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntity' + post: + tags: [Financial Values] + summary: Put a Financial Value against a project's Metric + description: | + Puts a Financial Value against one of the project's Metrics (a Change or an Indicator the project tracks or + records in its Stories), as the Financial Value calculator page does, and turns on the project's Financial + Calculator if it is off. Attaching one that is already there only changes its colour. A Financial Value shared + with Project colleagues only can only be used in its projects. For Project Managers and Organisation Admins. + operationId: attachProjectFinancialValue + security: [{tokenAuth: []}] + parameters: + - name: project_id + in: path + required: true + schema: { type: integer } + requestBody: + required: true + content: + application/json: + schema: + type: object + required: [metric_type, metric_id, financial_value_id] + properties: + metric_type: { type: string, enum: [Change, Indicator] } + metric_id: { type: integer } + financial_value_id: { type: integer } + color: { type: string, pattern: '^#[0-9a-fA-F]{6}$', description: "The Metric's colour on the calculator. Default the Metric's current colour, or #3595d5" } + example: + metric_type: Indicator + metric_id: 5521 + financial_value_id: 88 + responses: + "201": + description: The attachment + content: + application/json: + schema: { $ref: '#/components/schemas/ProjectFinancialValue' } + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntityList' + /projects/{project_id}/financial_values/{id}: + delete: + tags: [Financial Values] + summary: Take a Financial Value off a project's Metric + description: Removes one attachment, by its id from the list. For Project Managers and Organisation Admins. + operationId: detachProjectFinancialValue + security: [{tokenAuth: []}] + parameters: + - name: project_id + in: path + required: true + schema: { type: integer } + - name: id + in: path + required: true + schema: { type: integer } + description: The attachment id + responses: + "204": + description: Removed + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' /labels: get: tags: [Labels] @@ -28405,6 +28648,83 @@ components: type: string enum: [Person, Organisation, Animal, Object] + FinancialValue: + type: object + description: A published money value per person for an outcome, in the currency of its country + properties: + id: { type: integer, example: 88 } + name: { type: string, example: Moving into work } + code: { type: string, nullable: true, example: MIW } + amount: { type: string, description: The value per person, as a decimal string, example: '1234.5' } + currency: { type: string, example: GBP } + year: { type: integer, example: 2023 } + country: { type: string, nullable: true, example: United Kingdom } + category: + type: object + nullable: true + description: Its Methodology (Financial Value Category) + properties: + id: { type: integer } + name: { type: string } + sources: + type: array + items: + type: object + properties: + id: { type: integer } + name: { type: string } + publisher: { type: string, nullable: true, description: The web address of the source } + short_description: { type: string, nullable: true } + calculation_description: { type: string, nullable: true, description: Simple HTML } + verified: { type: boolean, description: Whether Makerble has checked it } + owner_type: { type: string, enum: [Organisation, User] } + owner_id: { type: integer } + privacy: + type: string + nullable: true + enum: [only_project_colleagues, only_charity_colleagues, charity_plus_network, everyone] + description: Who may use it + project_ids: { type: array, items: { type: integer }, description: The projects it may be used in, for only_project_colleagues } + created_at: { type: string, format: date-time } + updated_at: { type: string, format: date-time } + FinancialValueInput: + type: object + required: [name, amount, year, country, privacy] + properties: + name: { type: string } + amount: { type: number, description: The value per person, with no currency symbol } + year: { type: integer } + country: { type: string, description: The country's name. Sets its currency. } + privacy: + type: string + enum: [Project colleagues only, Organisation colleagues only, Network & organisation colleagues only, Everyone] + organisation_id: { type: integer, description: The organisation that will own it. Leave out to make it your own. } + project_ids: { type: array, items: { type: integer }, description: For Project colleagues only } + code: { type: string, description: Letters and numbers only } + category: { type: string, description: The name of its Methodology } + sources: { type: array, items: { type: string }, description: Names of its Sources } + publisher: { type: string } + short_description: { type: string } + calculation_description: { type: string } + ProjectFinancialValue: + type: object + description: One Financial Value put against one of a project's Metrics on its Financial Value calculator + properties: + id: { type: integer, description: The attachment id } + metric_type: { type: string, enum: [Change, Indicator] } + metric_id: { type: integer } + metric_name: { type: string } + color: { type: string, example: '#3595d5' } + financial_value: + type: object + properties: + id: { type: integer } + name: { type: string } + amount: { type: string } + currency: { type: string } + quantity: { type: integer, description: "The Metric's result in the project" } + sub_total: { type: string, description: quantity times the amount } + created_at: { type: string, format: date-time } Label: type: object description: A Label (Story Label), one of an organisation's themes for coding Stories and survey responses diff --git a/server.js b/server.js index a41ce86..cbae91c 100644 --- a/server.js +++ b/server.js @@ -962,6 +962,7 @@ function buildDocsPage() { GETExplore Metrics GETImpactStore POSTFramework Sets + POSTFinancial Values POSTSuggested Merges GETDuplicate Contacts GETField Visibility @@ -3411,6 +3412,71 @@ function buildDocsPage() { + +
+
Impact framework
+

Financial Values

+
+

A Financial Value is a published money value per person for an outcome, e.g. "Moving into work: £1,234 a year" from HACT, in the currency of its country. A project puts Financial Values against its Metrics (Changes and Indicators) on its Financial Value calculator (project › More Options › Financial Values). The project's financial value is each Metric's result times the amounts of its Financial Values, as on its Financial Calculator tile, added up separately for each currency.

+

You can use your own Financial Values, your organisations', those shared with you and those shared with everyone. One shared with only_project_colleagues can only be used in the projects in its project_ids.

+
+
+ ✓ + Workflow tip: Search GET /financial_values before creating one. Then put it against a project's Metric with POST /projects/{project_id}/financial_values, which also turns on the project's Financial Calculator. +
+
+ ${endpointCard("GET", "/financial_values", "Search the Financial Values you may use", true, [ + { name: "search", type: "string", required: false, desc: "Part of the name or code, case-insensitive" }, + { name: "category_id", type: "integer", required: false, desc: "Only this Methodology (Financial Value Category)" }, + { name: "source_id", type: "integer", required: false, desc: "Only those from this Source" }, + { name: "country_id", type: "integer", required: false, desc: "Only those for this country" }, + { name: "verified", type: "boolean", required: false, desc: "true for only those Makerble has checked, false for only unchecked ones" }, + { name: "page", type: "integer", required: false, desc: "Page number" }, + { name: "per_page", type: "integer", required: false, desc: "Records per page (default 10, max 200)" }, + { name: "last_synced_datetime", type: "string", required: false, desc: "ISO 8601 incremental sync" } + ], [ + { code: "200", cls: "response-2xx", desc: "Paginated Financial Values, by name: id, name, code, amount, currency, year, country, category, sources, publisher, short_description, calculation_description, verified, owner_type (Organisation or User), owner_id, privacy and project_ids" }, + { code: "422", cls: "response-4xx", desc: "per_page over 200" } + ])} + ${endpointCard("GET", "/financial_values/{id}", "Get a Financial Value", true, [ + { name: "id", in: "path", type: "integer", required: true, desc: "Financial Value ID" } + ], [ + { code: "200", cls: "response-2xx", desc: "The Financial Value" }, + { code: "404", cls: "response-4xx", desc: "Not found, or not one you may use" } + ])} + ${endpointCard("POST", "/financial_values", "Create a Financial Value", true, [], [ + { code: "201", cls: "response-2xx", desc: "The new Financial Value" }, + { code: "403", cls: "response-4xx", desc: "You aren't an Organisation Admin of organisation_id" }, + { code: "422", cls: "response-4xx", desc: "Something was wrong, e.g. a country that doesn't exist; existing_id when its owner already has a Financial Value with this name" } + ], "Body: name, amount (per person, no currency symbol), year, country (a name; sets the currency) and privacy (Project colleagues only, Organisation colleagues only, Network & organisation colleagues only or Everyone) are required. Optional: organisation_id (leave out to make it your own), project_ids (for Project colleagues only), code, category and sources (names), publisher, short_description, calculation_description.")} + ${endpointCard("GET", "/projects/{project_id}/financial_values", "List a project's Financial Values and their total", true, [ + { name: "project_id", in: "path", type: "integer", required: true, desc: "Project ID" }, + { name: "page", type: "integer", required: false, desc: "Page number" }, + { name: "per_page", type: "integer", required: false, desc: "Records per page (default 10, max 200)" } + ], [ + { code: "200", cls: "response-2xx", desc: "project_id, financial_calculator_enabled, totals (one per currency) and a page of attachments: id, metric_type, metric_id, metric_name, color, financial_value, quantity (the Metric's result) and sub_total" }, + { code: "403", cls: "response-4xx", desc: "You aren't a Project Manager or Organisation Admin of the project" }, + { code: "404", cls: "response-4xx", desc: "A project outside your organisations" } + ])} + ${endpointCard("POST", "/projects/{project_id}/financial_values", "Put a Financial Value against a project's Metric", true, [ + { name: "project_id", in: "path", type: "integer", required: true, desc: "Project ID" } + ], [ + { code: "201", cls: "response-2xx", desc: "The attachment" }, + { code: "403", cls: "response-4xx", desc: "You aren't a Project Manager or Organisation Admin of the project" }, + { code: "404", cls: "response-4xx", desc: "A project outside your organisations" }, + { code: "422", cls: "response-4xx", desc: "Not one of the project's Metrics, a Financial Value you may not use or one shared with other projects only, or a bad colour" } + ], "Body: metric_type (Change or Indicator), metric_id, financial_value_id and optional color (hex). Turns on the project's Financial Calculator if it is off. Attaching one that is already there only changes its colour.")} + ${endpointCard("DELETE", "/projects/{project_id}/financial_values/{id}", "Take a Financial Value off a project's Metric", true, [ + { name: "project_id", in: "path", type: "integer", required: true, desc: "Project ID" }, + { name: "id", in: "path", type: "integer", required: true, desc: "The attachment id, from the list" } + ], [ + { code: "204", cls: "response-2xx", desc: "Removed" }, + { code: "403", cls: "response-4xx", desc: "You aren't a Project Manager or Organisation Admin of the project" }, + { code: "404", cls: "response-4xx", desc: "Not one of this project's attachments" } + ])} +
+
+
Impact framework