Upsert Data Points

PUT /metrics/{metric_id}/data_points

Create or update multiple data points for a metric (limited to up to 50 data points per request).

If you don't know the metric's ID you can get it from the metric's URL in the app: https://app.visible.vc/companies/{company_id}/data/metrics/{metric_id}.

Path parameters

  • metric_id string(uuid) Required

    ID of the metric

application/json

Body Required

  • data_points array[object]

    Not more than 50 elements.

    Hide data_points attributes Show data_points attributes object
    • date string(date) Required

      Date for this data point (ISO 8601 format)

    • value string Required

      Value of the metric for this date

Responses

  • 200 application/json

    Data points successfully upserted

    Hide response attribute Show response attribute object
    • data_points array[object]
      Hide data_points attributes Show data_points attributes object
      • id string(uuid) Required

        Unique identifier for the data point

      • date string(date) Required

        Date for this data point (ISO 8601 format)

      • value string Required

        Value of the metric for this date (stored as string for precision)

      • metric_id string(uuid) Required

        ID of the associated metric

  • 400 application/json

    Bad Request - The request is invalid or malformed

    Hide response attribute Show response attribute object
    • errors array[object] Required

      Single error item. Different error types can include different fields.

      Hide errors attributes Show errors attributes object
      • type string

        Machine-readable error type

      • field string

        The related field, if applicable

      • message string

        Human-readable error message

  • 401 application/json

    Unauthorized - Invalid or missing authentication token

    Hide response attribute Show response attribute object
    • errors array[object] Required

      Single error item. Different error types can include different fields.

      Hide errors attributes Show errors attributes object
      • type string

        Machine-readable error type

      • field string

        The related field, if applicable

      • message string

        Human-readable error message

  • 404 application/json

    Not Found - The requested resource was not found

    Hide response attribute Show response attribute object
    • errors array[object] Required

      Single error item. Different error types can include different fields.

      Hide errors attributes Show errors attributes object
      • type string

        Machine-readable error type

      • field string

        The related field, if applicable

      • message string

        Human-readable error message

  • 422 application/json

    Unprocessable Entity - The request is valid but contains semantic errors

    Hide response attribute Show response attribute object
    • errors array[object] Required

      Single error item. Different error types can include different fields.

      Hide errors attributes Show errors attributes object
      • type string

        Machine-readable error type

      • field string

        The related field, if applicable

      • message string

        Human-readable error message

  • 429 application/json

    Too Many Requests - Rate limit exceeded

    Hide response attribute Show response attribute object
    • errors array[object] Required

      Single error item. Different error types can include different fields.

      Hide errors attributes Show errors attributes object
      • type string

        Machine-readable error type

      • field string

        The related field, if applicable

      • message string

        Human-readable error message

PUT /metrics/{metric_id}/data_points
curl \
 --request PUT 'https://api.visible.vc/metrics/{metric_id}/data_points' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"data_points":[{"date":"2019-01-01","value":"10.99"},{"date":"2019-02-01","value":"20.99"}]}'
Request example
{
  "data_points": [
    {
      "date": "2019-01-01",
      "value": "10.99"
    },
    {
      "date": "2019-02-01",
      "value": "20.99"
    }
  ]
}
Response examples (200)
{
  "data_points": [
    {
      "id": "e68ab11c-a41b-4725-976f-62542883a392",
      "date": "2019-01-01",
      "value": "10.99",
      "metric_id": "cad09a10-73e8-4205-ae67-4e6156f37be8"
    },
    {
      "id": "af692eaf-c8de-4a09-883b-1c12dbdf13ff",
      "date": "2019-02-01",
      "value": "20.99",
      "metric_id": "cad09a10-73e8-4205-ae67-4e6156f37be8"
    }
  ]
}
Response examples (400)
{
  "errors": [
    {
      "type": "parameter_invalid",
      "field": "filter",
      "message": "must be an object"
    }
  ]
}
Response examples (401)
{
  "errors": [
    {
      "type": "unauthorized"
    }
  ]
}
Response examples (404)
{
  "errors": [
    {
      "type": "record_missing"
    }
  ]
}
Response examples (422)
{
  "errors": [
    {
      "type": "attribute_invalid",
      "field": "value",
      "message": "required"
    }
  ]
}
Response examples (429)
{
  "errors": [
    {
      "type": "rate_limit_exceeded"
    }
  ]
}