Hosted Graphite Docs
Get StartedBook a Demo
  • Welcome to Hosted Graphite
  • Getting Started
  • HG-CLI
  • Sending Metrics
    • Supported Protocols
    • Graphite Tag Support
    • Metric Management
    • Metric APIs
  • Language Guide
    • Metric Libraries
    • .NET
    • Go
    • Java
    • Javascript
    • Node.js
    • PHP
    • Postman
    • Python 2.x
    • Python 3.x
    • Python Pickle
    • Ruby
    • Shell
    • TypeScript
  • Dashboard and Graphs
    • Primary Dashboards
    • Dashboard Library
    • Local Dashboard Integration
    • Worldmap Panel
    • Graphite Dashboard Guide
    • Graphite Graph Menu Reference
    • Other Dashboard Options
  • Alerting Guide
    • Alerting Overview
    • Alerts API
    • Notification Channels API
    • Scheduled Mutes API
    • Using Your Own Alerting
  • Agents Guide
    • The Hosted Graphite Agent
      • Base Metrics
      • System Layout
    • Telegraf
    • K8 Telegraf Daemon
    • OpenTelemetry
    • collectd Agent
    • StatsD Agent
    • Diamond
  • Add-Ons and Integrations Guide
    • AWS CloudWatch
    • Azure Monitor Metrics
    • GCP Metrics
    • Carbon-C-Relay
    • Circle CI
    • Cloudbees
    • Collectd Add Ons
    • GitHub
    • GitLab
    • Heroku
    • Hosted StatsD
    • New Relic
    • Papertrail
    • Pingdom
    • Sentry
    • Sitespeed
    • StatsD Add-on
    • Statuspage
  • Account Management
    • Access Keys
    • Account Diagnostics
    • Account Settings
    • Team Access: Limited Access Groups
    • SAML Authentication
    • Team Access
  • Additional Features
    • Aggregation Rules
    • Data Views
  • API Guides
    • Metrics API
    • Tag API
    • Graphite Render API
    • Render Variables API
    • Dashboard API
    • Annotations and Events API
    • Aggregation Rules API
    • Alerts APIs
  • FAQ
    • General
    • Business
    • Technical
    • Account Metrics and Limiting
    • Customization
    • Troubleshooting
    • Support
    • Changelog
Powered by GitBook
On this page
  • Dashboard Snapshot PNG
  • You can interact with your dashboard instance directly through Grafana's HTTP API
  • Create & Update dashboard
  • Get dashboard
  • Delete dashboard
  • Search dashboards
  • Create a New Folder

Was this helpful?

  1. API Guides

Dashboard API

PreviousRender Variables APINextAnnotations and Events API

Last updated 14 days ago

Was this helpful?

Contents

GET /api/v3/grafana/render/?target=

Returns PNG image of a dashboard panel. To display any data on the graph you must include a ‘target’, you can append multiple targets to the request as follows: ?target=foo.bar.A&target=foo.bar.B

Parameters

Name
Type
Description

target*

String

graphite query

from

String

Format: -<num>m|h|d|w|M|Y default: -6h

to

String

Format: now-<num>m|h|d|w|M|Y default: now

width

String

number measured in pixels default: 1000

height

String

number measured in pixels default: 500

style

String

Format: “light” | “dark ” default: dark

Curl Example:

curl -i -X GET \
"https://<api-key>@api.hostedgraphite.com/api/v3/grafana/render/?target=foo.bar"

Response:

HTTP/1.1 200
Content-Type: image/png

<image data>

Bad Request Invalid form data

Unauthorized

Time Queries:

  • m = Minutes

  • h = Hours

  • d = Days

  • w = Weeks

  • M = Months

  • Y = Years


To use the Grafana API, you will need to create a new Grafana Service Account Token within the Grafana UI (Settings => Service Accounts => Add Service Account with Admin role => Generate Service Account Token).

Additional Considerations:

  • Since MetricFire now hosts Grafana v9.5, dashboard JSON templates must now be wrapped in the following object, in order to create/update dashboards programatically ("folderID": 0, maps to the default "General" folder, but any folderID can be specified):

{
  "dashboard": {
    ...entire dashboard object...
  },
  "folderId": 0,
  "overwrite": true
}
  • In all below examples <UID> refers to the URL subdomain of your hosted instance, uid refers to the unique identifier of the related resource. Below are examples of requests made using the Grafana Dashboard HTTP API.

POST /api/dashboards/db

Creates a new dashboard or updates an existing dashboard

Example:

curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <SERVICE-ACCOUNT-TOKEN>" \
"https://<UID>.hostedgraphite.com/api/dashboards/db" \
-d @dashboard.json
HTTP/1.1 200
Content-Type: application/json
{
    "slug": "production-overview",
    "status": "success",
    "version": 1
}

Bad Request Invalid JSON

Conflict Dashboard already exists

Example dashboard.json file:

{
    "dashboard": {
        "title": "Minimal Dashboard",
        "panels": []
    },
    "folderId": 0,
    "overwrite": false
}

GET /api/dashboards/uid/:uid

Returns a dashboard given the dashboard's uid

Name
Value

Content-Type

application/json

Authorization

Bearer <SERVICE-ACCOUNT-TOKEN>

Curl examples:

curl -X GET \
-H "Authorization: Bearer <SERVICE-ACCOUNT-TOKEN>" \
"https://<UID>.hostedgraphite.com/api/dashboards/uid/<DASHBOARD-UID>"

Response:

HTTP/1.1 200
Content-Type: application/json
{ 
    "meta": { 
        "isStarred": false,
        "slug": "production-overview" 
    }, 
    "model": { 
        "id": null, 
        "title": "Production Overview",
        "tags": [ "templated" ],
        "timezone": "browser",
        "panels": [ { } ] 
        "schemaVersion": 6,
        "version": 0 
    }, 
}

Bad Request No dashboard specified

Not Found Dashboard not found


DELETE /api/dashboards/uid/:uid

Deletes a dashboard given the dashboard slug.

Name
Value

Content-Type

application/json

Authorization

Bearer <SERVICE-ACCOUNT-TOKEN>

Example:

curl -X DELETE \
-H "Authorization: Bearer <SERVICE-ACCOUNT-TOKEN>" \
"https://<UID>.hostedgraphite.com/api/dashboards/uid/<DASHBOARD-UID>"

Response:

HTTP/1.1 200
Content-Type: application/json
{
    "title": "Example Dash",
    "message": "Dashboard Example Dash deleted",
    "id": 3
}

Bad Request No dashboard specified

Dashboard not found


GET /api/search

Returns a list of dashboards given a search query.

Name
Value

Content-Type

application/json

Authorization

Bearer <SERVICE-ACCOUNT-TOKEN>

Example:

curl -X GET \
-H "Authorization: Bearer <SERVICE-ACCOUNT-TOKEN>" \
"https://<UID>.hostedgraphite.com/api/search"

Response:

HTTP/1.1 200
Content-Type: application/json
[
    {
        "id": 1,
        "title": "Production Overview",
        "uri": "db/production-overview",
        "type": "dash-db",
        "tags": [
            "templated",
            "production"
        ],
        "isStarred": true
    },
    {
        "id": 4,
        "title": "Production Webservers",
        "uri": "db/production-webservers",
        "type": "dash-db",
        "tags": [
            "production"
        ],
        "isStarred": true
    }
    ...
]

Bad Request Invalid form data


POST /api/folders

Creates a new folder for dashboard organization.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <SERVICE-ACCOUNT-TOKEN>

JSON Schema

Name
Type
Description

title

string

name of new folder

Example:

curl -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer  <SERVICE-ACCOUNT-TOKEN>" \
"https://<UID>.hostedgraphite.com/api/folders" -d '{"title": "Test Folder"}'

Response:

HTTP/1.1 200
Content-Type: application/json
{
    "id": 70,
    "uid": "bfc49500-7c2d-4d73-ba43-d8ab677d4836",
    "title": "Test Folder",
    "url": "/dashboards/f/bfc49500-7c2d-4d73-ba43-d8ab677d4836/test-folder",
    "hasAcl": false,
    "canSave": true,
    "canEdit": true,
    "canAdmin": true,
    "canDelete": true,
    "createdBy": "Anonymous",
    "created": "2024-10-15T13:10:22.922696496Z",
    "updatedBy": "Anonymous",
    "updated": "2024-10-15T13:10:22.922696646Z",
    "version": 1
}

Errors (invalid json, missing or invalid fields, etc

Folder already exists

You can interact with your dashboard instance directly through

Grafana's HTTP API
Dashboard HTTP API
Dashboard Snapshot PNG
Create dashboard
Get dashboard
Delete dashboard
Search dashboards
Create a New Folder
Dashboard Snapshot PNG
Create & Update dashboard
Get dashboard
Delete dashboard
Search dashboards
Create a New Folder
Create Service Account & Token
Create Service Account & Token