API ReferenceapianalyticsPOST /v1/outcomes

POST /v1/outcomes

Service: analytics · operationId: (none)

Required scopes

(no scope declared — review service config)

Request body

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1
    },
    "description": {
      "type": "string"
    },
    "brand_id": {
      "type": "string",
      "minLength": 1
    },
    "metric_key": {
      "type": "string",
      "minLength": 1
    },
    "unit": {
      "type": "string"
    },
    "direction": {
      "type": "string",
      "enum": [
        "higher_is_better",
        "lower_is_better"
      ]
    }
  },
  "required": [
    "name",
    "brand_id",
    "metric_key"
  ]
}

Responses

201 Outcome created

{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "brand_id": {
      "type": "string"
    },
    "metric_key": {
      "type": "string"
    },
    "unit": {
      "type": [
        "string",
        "null"
      ]
    },
    "direction": {
      "type": "string"
    },
    "created_by": {
      "type": "string"
    },
    "created_at": {
      "type": "string"
    },
    "updated_at": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "name",
    "description",
    "brand_id",
    "metric_key",
    "unit",
    "direction",
    "created_by",
    "created_at",
    "updated_at"
  ]
}

403 Forbidden — admin role required

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

500 Internal error

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

Example

curl -X POST https://analytics.platform.loop.health/v1/outcomes \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'