diff --git a/openapi.yaml b/openapi.yaml index 0dd61ad..a422120 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -14161,7 +14161,11 @@ paths: Change) in `Activity outputs` or `Participation outputs`; - `outcome_id` or `new_outcome` in `Short-term outcomes`, `Medium-term outcomes` or `Long-term outcomes`. An Outcome entry can also have `new_metrics`: new Metrics - (Indicators) that measure it. + (Indicators) that measure it, and `indicator_ids`: existing Metrics. For a reused Outcome, + the framework takes only those of its Metrics (plus its new Metrics) instead of all of + them, so projects using it don't get Metrics they don't need. For a new Outcome, they are + linked to it as they are, not copied. An id you can't see, or that isn't one of the reused + Outcome's Metrics, answers `404` and creates nothing. At most 50 entries and new Metrics together. Near-identical names of new items get `409` with the matches, each with its `entry`, unless you send `force: true`. Nothing is created @@ -14211,6 +14215,7 @@ paths: category: Education - stage: Short-term outcomes outcome_id: 3301 + indicator_ids: [5521, 5524] new_metrics: - name: "Job search hours" metric_type: value @@ -22013,7 +22018,13 @@ paths: Board (with `project_id` or `bundle_id`): as its last card, showing that Project's or Album's results; you must have created the board or be a Board Admin. A Cohort or Workflow Tracker goes in the `column` given (default `engagement`) of a Project in its own Organisation or of an Impact - Framework you created. There is no request body. + Framework you created. + + An Outcome added to a Project or Impact Framework brings every one of its Indicators unless + the body gives `indicator_ids`: then only those Indicators of the Outcome are added, and an + Indicator added to the Outcome later doesn't join that Project. Each id must be an Indicator of + the Outcome that you can see, or nothing is added (422). `indicator_ids` is refused for any + other metric or destination. Otherwise there is no request body. operationId: addMetricToDestination security: [{tokenAuth: []}] parameters: @@ -22024,6 +22035,20 @@ paths: - $ref: '#/components/parameters/MetricDestinationBundleId' - $ref: '#/components/parameters/MetricDestination' - $ref: '#/components/parameters/MetricDestinationTargetId' + requestBody: + required: false + content: + application/json: + schema: + type: object + properties: + indicator_ids: + type: array + items: {type: integer} + minItems: 1 + description: For an Outcome added to `projects` or `impact_frameworks`, only these of its Indicators. Leave out to add all of them. + example: + indicator_ids: [5521, 5524, 5530] responses: "201": description: Added @@ -25347,6 +25372,11 @@ components: type: string instruction: type: string + indicator_ids: + type: array + minItems: 1 + items: {type: integer} + description: Outcome entries only. Existing Metrics (Indicators). With outcome_id, only these of its Metrics (and any new_metrics) are taken instead of all of them; with new_outcome, they are linked to it without being copied. new_metrics: type: array description: Outcome entries only diff --git a/server.js b/server.js index d988877..68edb4f 100644 --- a/server.js +++ b/server.js @@ -2924,7 +2924,7 @@ function buildDocsPage() { ${endpointCard("POST", "/impact_frameworks", "Create an Impact Framework with its entries", true, [ { name: "organisation_id", in: "body", type: "integer", required: true, desc: "The organisation (Charity) that will own it; you must be one of its editors" }, { name: "name", in: "body", type: "string", required: true, desc: "e.g. Youth employment" }, - { name: "entries", in: "body", type: "array", required: true, desc: "In order. Each has a stage and exactly one of activity_tracker_id or new_activity_tracker {name, category} (Activity or Participation outputs), or outcome_id or new_outcome {title} (Short-, Medium- or Long-term outcomes). An Outcome entry can add new_metrics. At most 50 entries and new Metrics together" }, + { name: "entries", in: "body", type: "array", required: true, desc: "In order. Each has a stage and exactly one of activity_tracker_id or new_activity_tracker {name, category} (Activity or Participation outputs), or outcome_id or new_outcome {title} (Short-, Medium- or Long-term outcomes). An Outcome entry can add new_metrics, and indicator_ids of existing Metrics: only those of a reused Outcome's Metrics are taken, or they are linked to a new Outcome without being copied. At most 50 entries and new Metrics together" }, { name: "description / color / causes / department", in: "body", type: "string", required: false, desc: "Shown with the framework and used by the Explore filters" }, { name: "approved", in: "body", type: "boolean", required: false, desc: "Makerble staff only: share it in the public library and approve its new items" }, { name: "force", in: "body", type: "boolean", required: false, desc: "true to create new items even though near-identical ones exist (see 409)" } @@ -3832,11 +3832,12 @@ function buildDocsPage() { ], "Creates a Managed Progress Board named \"<your name>'s Progress Board\" for the Project's Organisation, with the Project on it and the metric as its card. No request body.")} ${endpointCard("POST", "/metrics/{metric_type}/{metric_id}/destinations/{destination}/{target_id}", "Add a metric to a Project, Impact Framework or Collection", true, [ { name: "target_id", in: "path", type: "integer", required: true, desc: "The Project, Impact Framework or Collection ID" }, - { name: "column", type: "string", required: false, desc: "For a Cohort or Workflow Tracker: the Impact Scorecard column (default engagement)" } + { name: "column", type: "string", required: false, desc: "For a Cohort or Workflow Tracker: the Impact Scorecard column (default engagement)" }, + { name: "indicator_ids", in: "body", type: "array", required: false, desc: "For an Outcome added to projects or impact_frameworks: only these of its Indicators. Leave out to add all of them" } ], [ { code: "201", cls: "response-2xx", desc: "{added: true}" }, - { code: "422", cls: "response-4xx", desc: "{error}: a Project you can't edit the metrics of, or one that already has the metric" } - ], "Adds a Change or Outcome as Edit Project Metrics does: in the Impact Scorecard column of its own stage, after the metrics already there, and to the Project's Default Survey. No request body.")} + { code: "422", cls: "response-4xx", desc: "{error}: a Project you can't edit the metrics of, one that already has the metric, or an indicator_ids entry that isn't an Indicator of the Outcome you can see" } + ], "Adds a Change or Outcome as Edit Project Metrics does: in the Impact Scorecard column of its own stage, after the metrics already there, and to the Project's Default Survey. An Outcome brings all its Indicators unless you give indicator_ids; Indicators added to the Outcome later then don't join that Project.")} ${endpointCard("DELETE", "/metrics/{metric_type}/{metric_id}/destinations/{destination}/{target_id}", "Remove a metric from a Project, Impact Framework or Collection", true, [ { name: "target_id", in: "path", type: "integer", required: true, desc: "The Project, Impact Framework or Collection ID" } ], [