Skip to main content
POST
/
graphql#ListDashboardWidgets
List dashboard widgets
curl --request POST \
  --url 'https://clarus-api.com/graphql#ListDashboardWidgets' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Clarus-Subdomain: <api-key>' \
  --data '
{
  "query": "query($filter: DashboardWidgetFilterType) { dashboard_widgets { all(filter: $filter) { edges { node { id code name description widget_type configuration dashboard_filters report_query_id } } } } }"
}
'
{
  "data": {
    "dashboard_widgets": {
      "all": {
        "edges": [
          {
            "node": {
              "id": "12",
              "code": "tasks-by-type",
              "name": "Tasks by Type",
              "description": "Open tasks grouped by task type",
              "widget_type": "bar",
              "configuration": {
                "metric": "total_records",
                "color_palette": "default",
                "show_legend": true,
                "legend_position": "bottom",
                "horizontal": false,
                "log_scale": false,
                "limit": 10
              },
              "dashboard_filters": {
                "warehouse_id": 1
              },
              "report_query_id": "4"
            }
          }
        ]
      }
    }
  }
}

Query Structure

query($filter: DashboardWidgetFilterType) {
  dashboard_widgets {
    all(filter: $filter) {
      edges {
        node {
          id
          code
          name
          description
          widget_type
          configuration
          dashboard_filters
          report_query_id
        }
      }
    }
  }
}

Filter Argument

All filters are passed inside the filter argument. Each filter field accepts an input object with operators:
{
  "filter": {
    "widget_type": {
      "eq": "bar"
    }
  }
}

Available Filters

FilterInput TypeOperatorsDescription
codeStringInputTypeeq, ilike, like, in, betweenWidget code
nameStringInputTypeeq, ilike, like, in, betweenWidget name
widget_typeDashboardWidgetTypeInputTypeeq, inRendering type (bar, line, pie, etc. — see create endpoint for full list)
report_query_idIdInputTypeeq, gt, gteq, lt, lteq, in, filledFilter by linked report query

Filter Operators

Input TypeOperators
StringInputTypeeq (exact), ilike (case-insensitive partial), like (case-sensitive partial), in (array match), between (range)
IntegerInputTypeeq, gt, gteq, lt, lteq, between
DatetimeInputTypeeq, from, to, between
BooleanInputTypeeq (required)
IdInputTypeeq, gt, gteq, lt, lteq, in, filled
More fields and filters available via GraphQL introspection.

Authorizations

Authorization
string
header
required

OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.

X-Clarus-Subdomain
string
header
required

The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.

Body

application/json
query
string<textarea>
required

GraphQL query string

Example:

"query($filter: DashboardWidgetFilterType) { dashboard_widgets { all(filter: $filter) { edges { node { id code name description widget_type configuration dashboard_filters report_query_id } } } } }"

variables
object

Query variables including the filter object

Example:
{
"filter": { "widget_type": { "eq": "bar" } }
}

Response

Successful GraphQL response

data
object

Query result data

errors
object[]

GraphQL errors, if any