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.1.tar.gz
.
File metadata
- Download URL: grafana-api-sdk-0.0.1.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73c7432fb6dce4d21087147d796616030a3722d75ce2375a5b044999947ff11f |
|
MD5 | f68915b82cf41f1afa61644ed95472ea |
|
BLAKE2b-256 | 78791d9326d7c5405948173924555d30efe939f41e36f359a2c59c81561fffe9 |
File details
Details for the file grafana_api_sdk-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: grafana_api_sdk-0.0.1-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ede8ba11fad2f0370e0223305c6f4965a6874f8a2da6c7642c365c75609e502 |
|
MD5 | b42d641b2a763001d4aae6561af27ad8 |
|
BLAKE2b-256 | 8f1ec44b38b9dd8ddf0a9e0a8abad3adf5970e642ef90d642ea80c9b18c885d4 |