A Grafana API SDK
Project description
Grafana API SDK
The repository includes an SDK for the Grafana API. It's possible to communicate with the Grafana API endpoints. Another feature of the SDK is the possibility to specify the used folder for the dashboard.
Currently, supported features
Dashboard
- Create/ Update a dashboard
- Delete a dashboard
- Get permissions of a dashboard
- Update the permissions of a dashboard
- Get all dashboard versions
- Get dashboard version of a specific dashboard
- Restore a dashboard version of a specific dashboard
- Compare two dashboard versions and extract the diff between booth dashboards
Folder
- Get folder id by dashboard path
- Get all folder ids and folder names
- Get all folders
- Get folder by uid
- Get folder by id
- Create a folder
- Update a folder
- Delete a folder
- Get permissions for a folder
- Update permissions for a folder
Search
- Execute a custom query against the Grafana search endpoint
Feature timeline
The following table describes the plan to implement the rest of the Grafana API functionality. Please, open an issue and vote them up, if you prefer a faster implementation of an API functionality.
API endpoint group | Implementation week | Maintainer | PR | State |
---|---|---|---|---|
Admin HTTP API | ||||
Alerting HTTP API | 4 | ZPascal | Planned | |
Alerting Notification Channels HTTP API | 4 | ZPascal | Planned | |
Annotations HTTP API | ||||
Authentication HTTP API | ||||
Data source HTTP API | 5 | ZPascal | Planned | |
Datasource Permissions HTTP API | ||||
External Group Sync HTTP API | ||||
Fine-grained access control HTTP API | ||||
HTTP Preferences API | ||||
HTTP Snapshot API | ||||
Library Element HTTP API | ||||
Licensing HTTP API | ||||
Organization HTTP API | ||||
Other HTTP API | ||||
Playlist HTTP API | ||||
Reporting API | ||||
Short URL HTTP API | ||||
Team HTTP API | ||||
User HTTP API |
Installation
pip install grafana-api-sdk
Example
import json
from grafana_api.model import APIModel
from grafana_api.dashboard import Dashboard
model: APIModel = APIModel(host="test", token="test")
dashboard: Dashboard = Dashboard(model)
with open("/tmp/test/test.json") as file:
json_dashboard = json.load(file)
dashboard.create_or_update_dashboard(message="Create a new test dashboard", dashboard_json=json_dashboard, dashboard_path="test")
Templating
If you want to template your JSON document based on a predefined folder structure you can check out one of my other project and integrate the functionality inside your code.
Contribution
If you would like to contribute something, have an improvement request, or want to make a change inside the code, please open a pull request.
Support
If you need support, or you encounter a bug, please don't hesitate to open an issue.
Donations
If you would like to support my work, I ask you to take an unusual action inside the open source community. Donate the money to a non-profit organization like Doctors Without Borders or the Children's Cancer Aid. I will continue to build tools because I like it and it is my passion to develop and share applications.
License
This product is available under the Apache 2.0 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file grafana-api-sdk-0.0.2.tar.gz
.
File metadata
- Download URL: grafana-api-sdk-0.0.2.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 410ff2b39987abeabf72a866396aac441cfc7029a28958ce10620ec206f97bea |
|
MD5 | ab1493c74ae83d032135734415884023 |
|
BLAKE2b-256 | 480e0355817903d689958cc0bf002ff3874172e5e34b3f7dde3778e2f5c377d4 |
File details
Details for the file grafana_api_sdk-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: grafana_api_sdk-0.0.2-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a0860d8080c1aa23bc27f093d331942ad736a1fe9ff3940d4f8af2d47ca314c |
|
MD5 | cef772bf9c69ae70de37f8c2fd647684 |
|
BLAKE2b-256 | 9ea8c2c613d55459c2cf77f62c730484fed64bb9678eadfe612bf25b957c07d2 |