CreateWidget

POST/analytics/v1/dashboards/{dashboard_id}/widgets

Path Parameters

dashboard_id*dashboard_id

The dashboard_id path parameter.

Query Parameters

expected_revision*expected_revision

The expected_revision query parameter.

Formatint32

Request Body

application/json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/analytics.v1.WidgetInput",
      "$ref-value": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "title": "title"
          },
          "chart_type": {
            "type": "string",
            "title": "chart_type"
          },
          "dataset": {
            "type": "string",
            "title": "dataset"
          },
          "metric": {
            "type": "string",
            "title": "metric"
          },
          "group_by": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "title": "group_by"
          },
          "filters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/analytics.v1.ChartFilter",
              "$ref-value": {
                "type": "object",
                "properties": {
                  "field": {
                    "type": "string",
                    "examples": [
                      "country"
                    ],
                    "title": "field"
                  },
                  "operator": {
                    "type": "string",
                    "examples": [
                      "eq"
                    ],
                    "title": "operator",
                    "enum": [
                      "eq",
                      "neq",
                      "gt",
                      "gte",
                      "lt",
                      "lte",
                      "in",
                      "not_in",
                      "contains",
                      "not_contains",
                      "starts_with",
                      "ends_with",
                      "between",
                      "is_empty",
                      "is_not_empty"
                    ]
                  },
                  "values": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "title": "values"
                  }
                },
                "title": "ChartFilter",
                "required": [
                  "field"
                ],
                "additionalProperties": false
              }
            },
            "title": "filters"
          },
          "interval": {
            "type": "string",
            "title": "interval"
          },
          "limit": {
            "type": "integer",
            "title": "limit",
            "format": "int32"
          },
          "pos_x": {
            "type": "integer",
            "title": "pos_x",
            "format": "int32"
          },
          "pos_y": {
            "type": "integer",
            "title": "pos_y",
            "format": "int32"
          },
          "width": {
            "type": "integer",
            "title": "width",
            "format": "int32"
          },
          "height": {
            "type": "integer",
            "title": "height",
            "format": "int32"
          },
          "sort_order": {
            "type": "integer",
            "title": "sort_order",
            "format": "int32"
          }
        },
        "title": "WidgetInput",
        "required": [
          "title",
          "chart_type",
          "dataset",
          "metric"
        ],
        "additionalProperties": false
      }
    }
  ],
  "title": "widget"
}

Response Body

200application/json

Success

type: unknown

{
  "$ref": "#/components/schemas/analytics.v1.Widget",
  "$ref-value": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "title": "id"
      },
      "dashboard_id": {
        "type": "string",
        "title": "dashboard_id"
      },
      "title": {
        "type": "string",
        "examples": [
          "Requests over time"
        ],
        "title": "title"
      },
      "chart_type": {
        "type": "string",
        "examples": [
          "timeseries"
        ],
        "title": "chart_type"
      },
      "dataset": {
        "type": "string",
        "examples": [
          "content_views"
        ],
        "title": "dataset"
      },
      "metric": {
        "type": "string",
        "examples": [
          "views"
        ],
        "title": "metric"
      },
      "group_by": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "title": "group_by"
      },
      "filters": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/analytics.v1.ChartFilter",
          "$ref-value": {
            "type": "object",
            "properties": {
              "field": {
                "type": "string",
                "examples": [
                  "country"
                ],
                "title": "field"
              },
              "operator": {
                "type": "string",
                "examples": [
                  "eq"
                ],
                "title": "operator",
                "enum": [
                  "eq",
                  "neq",
                  "gt",
                  "gte",
                  "lt",
                  "lte",
                  "in",
                  "not_in",
                  "contains",
                  "not_contains",
                  "starts_with",
                  "ends_with",
                  "between",
                  "is_empty",
                  "is_not_empty"
                ]
              },
              "values": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "title": "values"
              }
            },
            "title": "ChartFilter",
            "required": [
              "field"
            ],
            "additionalProperties": false
          }
        },
        "title": "filters"
      },
      "interval": {
        "type": "string",
        "examples": [
          "1h"
        ],
        "title": "interval"
      },
      "limit": {
        "type": "integer",
        "title": "limit",
        "format": "int32"
      },
      "pos_x": {
        "type": "integer",
        "title": "pos_x",
        "format": "int32"
      },
      "pos_y": {
        "type": "integer",
        "title": "pos_y",
        "format": "int32"
      },
      "width": {
        "type": "integer",
        "examples": [
          "4"
        ],
        "title": "width",
        "format": "int32"
      },
      "height": {
        "type": "integer",
        "examples": [
          "3"
        ],
        "title": "height",
        "format": "int32"
      },
      "sort_order": {
        "type": "integer",
        "title": "sort_order",
        "format": "int32"
      },
      "created_at": {
        "type": "string",
        "title": "created_at"
      },
      "updated_at": {
        "type": "string",
        "title": "updated_at"
      },
      "spec_version": {
        "type": "integer",
        "title": "spec_version",
        "format": "int32"
      },
      "dashboard_revision": {
        "type": "integer",
        "title": "dashboard_revision",
        "format": "int32"
      }
    },
    "title": "Widget",
    "additionalProperties": false
  }
}
curl -X POST "https://api.rixl.com/analytics/v1/dashboards/string/widgets?expected_revision=0" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "string",
    "chart_type": "string",
    "dataset": "string",
    "metric": "string"
  }'

Success

application/json

{
  "$ref": "#/components/schemas/analytics.v1.Widget",
  "$ref-value": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "title": "id"
      },
      "dashboard_id": {
        "type": "string",
        "title": "dashboard_id"
      },
      "title": {
        "type": "string",
        "examples": [
          "Requests over time"
        ],
        "title": "title"
      },
      "chart_type": {
        "type": "string",
        "examples": [
          "timeseries"
        ],
        "title": "chart_type"
      },
      "dataset": {
        "type": "string",
        "examples": [
          "content_views"
        ],
        "title": "dataset"
      },
      "metric": {
        "type": "string",
        "examples": [
          "views"
        ],
        "title": "metric"
      },
      "group_by": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "title": "group_by"
      },
      "filters": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/analytics.v1.ChartFilter",
          "$ref-value": {
            "type": "object",
            "properties": {
              "field": {
                "type": "string",
                "examples": [
                  "country"
                ],
                "title": "field"
              },
              "operator": {
                "type": "string",
                "examples": [
                  "eq"
                ],
                "title": "operator",
                "enum": [
                  "eq",
                  "neq",
                  "gt",
                  "gte",
                  "lt",
                  "lte",
                  "in",
                  "not_in",
                  "contains",
                  "not_contains",
                  "starts_with",
                  "ends_with",
                  "between",
                  "is_empty",
                  "is_not_empty"
                ]
              },
              "values": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "title": "values"
              }
            },
            "title": "ChartFilter",
            "required": [
              "field"
            ],
            "additionalProperties": false
          }
        },
        "title": "filters"
      },
      "interval": {
        "type": "string",
        "examples": [
          "1h"
        ],
        "title": "interval"
      },
      "limit": {
        "type": "integer",
        "title": "limit",
        "format": "int32"
      },
      "pos_x": {
        "type": "integer",
        "title": "pos_x",
        "format": "int32"
      },
      "pos_y": {
        "type": "integer",
        "title": "pos_y",
        "format": "int32"
      },
      "width": {
        "type": "integer",
        "examples": [
          "4"
        ],
        "title": "width",
        "format": "int32"
      },
      "height": {
        "type": "integer",
        "examples": [
          "3"
        ],
        "title": "height",
        "format": "int32"
      },
      "sort_order": {
        "type": "integer",
        "title": "sort_order",
        "format": "int32"
      },
      "created_at": {
        "type": "string",
        "title": "created_at"
      },
      "updated_at": {
        "type": "string",
        "title": "updated_at"
      },
      "spec_version": {
        "type": "integer",
        "title": "spec_version",
        "format": "int32"
      },
      "dashboard_revision": {
        "type": "integer",
        "title": "dashboard_revision",
        "format": "int32"
      }
    },
    "title": "Widget",
    "additionalProperties": false
  }
}