Dashboard HTTP API

Contents

Hosted Graphite supports an HTTP API which allows you to fetch, create, and update your primary dashboards.

Create dashboard

POST /api/v2/grafana/dashboards

Curl example:

curl -X POST https://YOUR-API-KEY@api.hostedgraphite.com/api/v2/grafana/dashboards/ \
     -d @dashboard.json

Example dashboard.json file:

{
    "title": "Production Overview",
    "tags": [ "templated" ],
    "timezone": "browser",
    "panels": [
        {
        }
    ],
    "schemaVersion": 6,
    "version": 0
}

This example creates a dashboard with the name “Production Overview” in accordance with the title field above.


Update dashboard

PUT /api/v2/grafana/dashboards

Curl example:

curl -X PUT https://YOUR-API-KEY@api.hostedgraphite.com/api/v2/grafana/dashboards/ \
     -d @dashboard.json

Example dashboard:

{
    "id": 1
    "title": "Production Overview",
    "tags": [ "templated", "prod" ],
    "timezone": "browser",
    "panels": [
        {
        }
    ],
    "schemaVersion": 6,
    "message": "version control message" // this is optional
}

Get dashboard

GET /api/v2/grafana/dashboards/:slug

Returns a dashboard given the dashboard slug, a url friendly version of the dashboard title.

Curl examples:

curl -X GET https://YOUR-API-KEY@api.hostedgraphite.com/api/v2/grafana/search\?

Returns all dashboard/folder information

curl -X GET https://YOUR-API-KEY@api.hostedgraphite.com/api/v2/grafana/dashboards/production-overview

Returns the JSON model of a dashboard with the title of 'production overview'


Delete dashboard

DELETE /api/v2/grafana/dashboards/:slug

Deletes a dashboard given the dashboard slug.

Curl example:

curl -X DELETE https://YOUR-API-KEY@api.hostedgraphite.com/api/v2/grafana/dashboards/production-overview

List dashboard tags

GET /api/v2/grafana/tags

Curl example:

curl -X GET https://YOUR-API-KEY@api.hostedgraphite.com/api/v2/grafana/tags

Search dashboards

GET /api/v2/grafana/search

Returns a list of dashboards given a search query.

Curl example:

curl -i -X GET https://YOUR-API-KEY@api.hostedgraphite.com/api/v2/grafana/search?query=prod

Curl Example to Return all Dashboards:

curl -i -X GET https://YOUR-API-KEY@api.hostedgraphite.com/api/v2/grafana/search\?query\=%

Render dashboard png

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

Returns a link to a publicly accessible 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

Path Parameters

Curl Example:

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

Time Queries:

  • m = Minutes

  • h = Hours

  • d = Days

  • w = Weeks

  • M = Months

  • Y = Years

You can access additional dashboard/folder details using the Grafana HTTP API, just make sure to create a new Grafana API Key that you can use for the Authorization Header in your requests:

Example curl request to create a new Folder using the Grafana API:

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

Last updated