Graphing with JSON
New announcements from Dash: Incident Management, Continuous Profiler, and more! New announcements from Dash!

Graphing with JSON

If you query a Datadog timeboard though the dashboard API, the result is a JSON object with the following layout:

DASHBOARD_SCHEMA = {
    "type": "object",
    "properties": {
        "title": {"type": "string"},
        "description": {"type": "string"},
        "layout_type": {"enum": ["ordered", "free"]},
        "is_read_only": {"type": "boolean"},
        "template_variables": {"type": "array", "items": TEMPLATE_VARIABLE_SCHEMA},
        "notify_list": {"type": "array", "items": {"type": "string"}},
        "widgets": {
            "type": "array",
            "items": WIDGET_SCHEMA
        }
    },
    "required": ["title", "layout_type", "widgets"],
}
ParameterTypeDescription
titlestringTitle of your dashboard.
descriptionstringDescription of the dashboard.
layout_typeenumLayout type of the dashboard. Available values are: ordered or free
is_read_onlyBooleanWhether this dashboard is read-only. If true, only the dashboard author and administrators can apply changes to it.
template_variablesarray of objectList of template variables for this dashboard. See the template variable schema documentation to learn more.
notify_listarray of stringsList of handles of users to notify when changes are made to this dashboard.
widgetsarray of objectList of widgets to display on the dashboard. See the dedicated Widget JSON schema documentation to build the WIDGET_SCHEMA.

Template variable schema

Dashboard template variables apply a new scope to one or more graphs on your dashboard. This allows you to dynamically explore metrics across different sets of tags by using variables instead of specific tags. To configure them through the Dashboard API, use the following layout:

TEMPLATE_VARIABLE_SCHEMA = {
    "type": "object",
    "properties": {
        "name": {"type": "string"},
        "default": {"type": "string"},
        "prefix": {"type": "string"},
    },
    "additionalProperties": false,
    "required": ["name"]
}
ParameterTypeDescription
namestringName of your template variable.
defaultstringDefault value for your template variable.
prefixstringTag key for your template variable.

Learn more about template variable in the Datadog UI.

Further Reading

Additional helpful documentation, links, and articles: