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:
Example dashboard.json file:
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:
Example dashboard:
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:
Returns all dashboard/folder information
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:
List dashboard tags
GET
/api/v2/grafana/tags
Curl example:
Search dashboards
GET
/api/v2/grafana/search
Returns a list of dashboards given a search query.
Curl example:
Curl Example to Return all Dashboards:
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
Name | Type | Description |
---|---|---|
target* | String | to match a metric pattern |
from | String | Format: -<num>m|h|d|w|M|Y default: -6h |
to | String | Format: now-<num>m|h|d|w|M|Y |
width | String | number measured in pixels default: 1000 |
height | String | number measured in pixels default: 500 |
theme | String | Format: “light” | “dark ” default: dark |
fill | String | Format: number in range 0 (no fill) to 10 default: 1 |
Curl Example:
Time Queries:
m
= Minutesh
= Hoursd
= Daysw
= WeeksM
= MonthsY
= 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