Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,19 +193,39 @@ In general my focus inside this project is to implement and deliver old and new
- Manually force license refresh
- Remove the license from the database

### Annotation
- Find annotations
- Create annotation
- Create graphite annotation
- Update annotation
- Delete annotation
- Find annotation tags

### External Groups
- Get external groups
- Add external group
- Remove external group

### Authentication
- Get api tokens
- Create a api token
- Delete a api token

### Preferences
- Get current user preferences
- Update current user preferences
- Get current org preferences
- Update current org preferences

## 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](https://grafana.com/docs/grafana/latest/http_api/admin/) | | | | |
| [Annotations HTTP API](https://grafana.com/docs/grafana/latest/http_api/annotations/) | 23 | [ZPascal](https://github.com/ZPascal) | | |
| [Authentication HTTP API](https://grafana.com/docs/grafana/latest/http_api/auth/) | 23 | [ZPascal](https://github.com/ZPascal) | | |
| [External Group Sync HTTP API](https://grafana.com/docs/grafana/latest/http_api/external_group_sync/) | 23 | [ZPascal](https://github.com/ZPascal) | | |
| [Fine-grained access control HTTP API](https://grafana.com/docs/grafana/latest/http_api/access_control/) | | | | |
| [HTTP Preferences API](https://grafana.com/docs/grafana/latest/http_api/preferences/) | 23 | [ZPascal](https://github.com/ZPascal) | | |
| [Library Element HTTP API](https://grafana.com/docs/grafana/latest/http_api/library_element/) | | | | |
| [Admin HTTP API](https://grafana.com/docs/grafana/latest/http_api/admin/) | 25 | | | |
| [Fine-grained access control HTTP API](https://grafana.com/docs/grafana/latest/http_api/access_control/) | 25 | | | |
| [Library Element HTTP API](https://grafana.com/docs/grafana/latest/http_api/library_element/) | 25 | | | |

## Installation

Expand Down
4 changes: 3 additions & 1 deletion docs/content/grafana_api/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ The class includes all necessary methods to make API calls to the Grafana API en
def call_the_api(api_call: str,
method: RequestsMethods = RequestsMethods.GET,
json_complete: str = None,
timeout: float = None) -> any
timeout: float = None,
org_id_header: int = None) -> any
```

The method execute a defined API call against the Grafana endpoints
Expand All @@ -46,6 +47,7 @@ The method execute a defined API call against the Grafana endpoints
- `method` _RequestsMethods_ - Specify the used method (default GET)
- `json_complete` _str_ - Specify the inserted JSON as string
- `timeout` _float_ - Specify the timeout for the corresponding API call
- `org_id_header` _int_ - Specify the optional organization id for the corresponding API call


**Raises**:
Expand Down
61 changes: 61 additions & 0 deletions docs/content/grafana_api/model.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
* [TeamObject](#grafana_api.model.TeamObject)
* [QueryDatasourceObject](#grafana_api.model.QueryDatasourceObject)
* [QueryObject](#grafana_api.model.QueryObject)
* [FindAnnotationObject](#grafana_api.model.FindAnnotationObject)
* [AnnotationObject](#grafana_api.model.AnnotationObject)
* [AnnotationGraphiteObject](#grafana_api.model.AnnotationGraphiteObject)

<a id="grafana_api.model"></a>

Expand Down Expand Up @@ -293,3 +296,61 @@ The class includes all necessary variables to generate a query object that is ne
- `scenario_id` _str_ - Specify the scenario_id of the query history
- `datasource` _QueryDatasourceObject_ - Specify the datasource of the type QueryDatasourceObject

<a id="grafana_api.model.FindAnnotationObject"></a>

## FindAnnotationObject Objects

```python
class FindAnnotationObject(NamedTuple)
```

The class includes all necessary variables to generate a find annotation object

**Arguments**:

- `from_value` _int_ - Specify the optional from value (default None)
- `to_value` _int_ - Specify the optional to value (default None)
- `limit` _int_ - Specify the optional limit (default 100)
- `alert_id` _int_ - Specify the optional alert id (default None)
- `dashboard_id` _int_ - Specify the optional dashboard id (default None)
- `panel_id` _int_ - Specify the optional panel_id (default None)
- `user_id` _int_ - Specify the optional user id (default None)
- `type` _str_ - Specify the optional type e.g. alert or annotation (default None)
- `tags` _list_ - Specify the optional tags (default None)

<a id="grafana_api.model.AnnotationObject"></a>

## AnnotationObject Objects

```python
class AnnotationObject(NamedTuple)
```

The class includes all necessary variables to generate an annotation object

**Arguments**:

- `time` _int_ - Specify the time as number in milliseconds
- `time_end` _int_ - Specify the end time as number in milliseconds
- `tags` _list_ - Specify the organization annotation tags from a data source that are not connected specifically to a dashboard or panel
- `text` _str_ - Specify the annotation description message
- `dashboard_uid` _str_ - Specify the optional dashboard_uid (default None)
- `panel_id` _int_ - Specify the optional panel_id (default None)

<a id="grafana_api.model.AnnotationGraphiteObject"></a>

## AnnotationGraphiteObject Objects

```python
class AnnotationGraphiteObject(NamedTuple)
```

The class includes all necessary variables to generate a Graphite annotation object

**Arguments**:

- `what` _str_ - Specify the event of the annotation
- `tags` _list_ - Specify the organization annotation tags from a data source that are not connected specifically to a dashboard or panel
- `when` _int_ - Specify the optional time as number in milliseconds
- `data` _str_ - Specify the optional annotation description message

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name="grafana-api-sdk",
version="0.0.5",
version="0.0.6",
author="Pascal Zimmermann",
author_email="info@theiotstudio.com",
description="A Grafana API SDK",
Expand Down
Loading