Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document new /variable endpoint #232

Merged
merged 1 commit into from
Feb 21, 2022
Merged
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
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The JSON Datasource executes requests against arbitrary backends and parses JSON
- [API](#api)
- [/search](#search)
- [/query](#query)
- [/variable](#variable)
- [/tag-keys](#tag-keys)
- [/tag-values](#tag-values)
- [Development Setup](#development-setup)
Expand Down Expand Up @@ -45,8 +46,9 @@ To work with this datasource the backend needs to implement 3 endpoints:
- `POST /search` to return available metrics.
- `POST /query` to return panel data or annotations.

Those two urls are optional:
Those 3 endpoints are optional:

- `POST /variable` to return data for Variable of type `Query`.
- `POST /tag-keys` returning tag keys for ad hoc filters.
- `POST /tag-values` returning tag values for ad hoc filters.

Expand Down Expand Up @@ -204,6 +206,35 @@ You can also enter variables:

![Additional data variable input](https://raw.githubusercontent.com/simPod/grafana-json-datasource/0.3.x/docs/images/additional-data-variable-input.png)

### /variable

`POST /variable`

Example request body:

```json
{
"payload":{"target":"systems"},
"range":{
"from":"2022-02-14T08:09:32.164Z",
"to":"2022-02-21T08:09:32.164Z",
"raw":{"from":"now-7d","to":"now"}
}
}
```

`"payload"` is value from your input in Variable edit form.

Example response

```json
[
{"__text":"Label 1", "value":"Value1"},
{"__text":"Label 2", "value":"Value2"},
{"__text":"Label 3", "value":"Value3"}
]
```

### /tag-keys

`POST /tag-keys`
Expand Down