Skip to content

Commit 2ef414e

Browse files
committed
Update documentation
1 parent 2a253ed commit 2ef414e

File tree

5 files changed

+24
-80
lines changed

5 files changed

+24
-80
lines changed

README.md

Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -7,68 +7,10 @@
77
[![License](https://img.shields.io/github/license/marcusolsson/grafana-json-datasource)](LICENSE)
88
[![Twitter](https://img.shields.io/twitter/follow/marcusolsson?color=%231DA1F2&label=twitter&style=plastic)](https://twitter.com/marcusolsson)
99

10-
A data source plugin for loading JSON APIs into [Grafana](https://grafana.com).
10+
A data source plugin for loading JSON APIs into [Grafana](https://grafana.com) using [JSONPath](https://goessner.net/articles/JsonPath/).
1111

1212
![Screenshot](https://github.com/marcusolsson/grafana-json-datasource/raw/main/src/img/screenshot.png)
1313

14-
Extract one or more values from a JSON API using [JSON Path](https://goessner.net/articles/JsonPath/). Each path results in a field in the query result. All fields need to be of the same length.
14+
## Documentation
1515

16-
## Configuration
17-
18-
This section lists the available configuration options for the JSON API data source.
19-
20-
### Query editor
21-
22-
| Configuration | Description |
23-
|---------------|-------------|
24-
| **Path** | Appends a URL path to the URL configured by the data source. |
25-
| **Query string** | Overrides the custom query parameters configured by the data source. |
26-
| **Cache Time** | Determines the time in seconds to save the API response. |
27-
| **Query** | Defines the [JSON Path](https://goessner.net/articles/JsonPath/) used to extract the field. |
28-
| **Type** | Defines the type of the values returned by the JSON Path query. |
29-
30-
### Variables
31-
32-
[Variables](https://grafana.com/docs/grafana/latest/variables) are supported for all text configuration options.
33-
34-
### Macros
35-
36-
Use macros in your query string and JSON Path queries to add dashboard context to your queries. Macros are available for the **Query string** and (JSON Path) **Query** options.
37-
| Macro | Description |
38-
|-------|-------------|
39-
| `$__unixEpochFrom()` | Start of the dashboard time interval as a Unix timestamp, i.e. 1494410783 |
40-
| `$__unixEpochTo()` | End of the dashboard time interval as a Unix timestamp, i.e. 1494410783 |
41-
42-
## Public data sets
43-
44-
Here are a few publicly available JSON data sets that you can try out.
45-
46-
### Reddit
47-
48-
Get information about any subreddit by adding `.json` at the end of the URL.
49-
50-
#### Configuration
51-
52-
- **URL:** `https://www.reddit.com/r/grafana.json`
53-
54-
#### Sample queries
55-
56-
- `$.data.children[*].data.title`
57-
- `$.data.children[*].data.created_utc`
58-
- `$.data.children[*].data.ups`
59-
60-
### TVmaze
61-
62-
List episodes from your favorite TV series.
63-
64-
#### Configuration
65-
66-
- **URL:** `http://api.tvmaze.com/singlesearch/shows`
67-
- **Query string:** `q=archer&embed=episodes`
68-
69-
#### Sample queries
70-
71-
- `$._embedded.episodes[*].name`
72-
- `$._embedded.episodes[*].airstamp`
73-
- `$._embedded.episodes[*].season`
74-
- `$._embedded.episodes[*].number`
16+
Full documentation for the plugin is available on the [website](https://marcusolsson.github.io/grafana-json-datasource).

website/docs/macros.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
id: macros
3+
title: Macros
4+
---
5+
6+
Use macros to add dashboard context to your queries. Macros are available in HTTP params and JSONPath expressions.
7+
8+
| Macro | Description |
9+
|----------------------|---------------------------------------------------------------------------|
10+
| `$__unixEpochFrom()` | Start of the dashboard time interval as a Unix timestamp, i.e. 1494410783 |
11+
| `$__unixEpochTo()` | End of the dashboard time interval as a Unix timestamp, i.e. 1494410783 |

website/docs/query-editor.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,3 @@ Sets the text to send as a request body.
5555
- **Syntax highlighting** sets the active syntax for the editor. This is only for visual purposes and doesn't change the actual request.
5656

5757
> **Note:** Due to limitations in modern browsers, Grafana ignores the request body if the HTTP method is set to GET.
58-
59-
## Macros
60-
61-
Use macros in your query string and JSON Path queries to add dashboard context to your queries.
62-
63-
| Macro | Description |
64-
|----------------------|---------------------------------------------------------------------------|
65-
| `$__unixEpochFrom()` | Start of the dashboard time interval as a Unix timestamp, i.e. 1494410783 |
66-
| `$__unixEpochTo()` | End of the dashboard time interval as a Unix timestamp, i.e. 1494410783 |

website/docusaurus.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
title: 'JSON API for Grafana',
33
url: 'https://marcusolsson.github.io',
4-
baseUrl: '/grafana-json-datasource/',
4+
baseUrl: '/grafana-json-datasource',
55
onBrokenLinks: 'throw',
66
onBrokenMarkdownLinks: 'warn',
77
favicon: 'img/favicon.ico',
@@ -83,7 +83,7 @@ module.exports = {
8383
{
8484
docs: {
8585
sidebarPath: require.resolve('./sidebars.js'),
86-
editUrl: 'https://github.com/marcusolsson/grafana-json-datasource/edit/main/docs/',
86+
editUrl: 'https://github.com/marcusolsson/grafana-json-datasource/edit/main/website/',
8787
routeBasePath: '/',
8888
},
8989
theme: {

website/sidebars.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
module.exports = {
22
someSidebar: [
33
{
4-
type: "doc",
5-
id: "introduction",
4+
type: 'doc',
5+
id: 'introduction',
66
},
77
{
8-
type: "category",
9-
label: "Getting started",
10-
items: ["installation", "configuration"],
8+
type: 'category',
9+
label: 'Getting started',
10+
items: ['installation', 'configuration'],
1111
},
1212
{
13-
type: "category",
14-
label: "Basics",
15-
items: ["query-editor"],
13+
type: 'category',
14+
label: 'Basics',
15+
items: ['query-editor', 'macros'],
1616
},
1717
],
1818
};

0 commit comments

Comments
 (0)