Skip to content

Commit 5154b18

Browse files
committed
update docs
1 parent 71896bd commit 5154b18

File tree

1 file changed

+110
-84
lines changed

1 file changed

+110
-84
lines changed

docs/api/_index.md

Lines changed: 110 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,26 @@ These endpoints are available if the `WEBServer` is enabled in the modules secti
1313

1414
### /
1515

16-
Redirects to `/index.hmtl`
16+
Redirects to `/index.html`
1717

1818
### /index.html
1919

2020
Returns simple OK message:
2121

2222
Example:
2323

24-
curl \
25-
-u user:changeme \
26-
-X POST \
27-
https://127.0.0.1:8443/index.html
24+
```bash
25+
curl \
26+
-u user:changeme \
27+
-X POST \
28+
https://127.0.0.1:8443/index.html
29+
```
2830

2931
Returns:
3032

31-
snclient working...
33+
```text
34+
snclient working...
35+
```
3236

3337
## Checks Endpoints
3438

@@ -40,68 +44,76 @@ Legacy check command endpoint.
4044

4145
Example:
4246

43-
curl \
44-
-u user:changeme \
45-
-X POST \
46-
https://127.0.0.1:8443/query/check_uptime
47+
```bash
48+
curl \
49+
-u user:changeme \
50+
-X POST \
51+
https://127.0.0.1:8443/query/check_uptime
52+
```
4753

4854
### /api/v1/queries/{command}/commands/execute
4955

5056
Version 1 check command endpoint.
5157

5258
Example:
5359

54-
curl \
55-
-u user:changeme \
56-
-X POST \
57-
https://127.0.0.1:8443/api/v1/queries/check_uptime/commands/execute
60+
```bash
61+
curl \
62+
-u user:changeme \
63+
-X POST \
64+
https://127.0.0.1:8443/api/v1/queries/check_uptime/commands/execute
65+
```
5866

5967
### /api/v1/inventory
6068

6169
Returns the check inventory as json
6270

6371
Example:
6472

65-
curl \
66-
-u user:changeme \
67-
-X POST \
68-
https://127.0.0.1:8443/api/v1/inventory
73+
```bash
74+
curl \
75+
-u user:changeme \
76+
-X POST \
77+
https://127.0.0.1:8443/api/v1/inventory
78+
```
6979

7080
Returns:
7181

72-
{
73-
"inventory": {
74-
"cpu": [
75-
{
76-
"core": "core1",
77-
"core_id": "core1",
78-
"load": "43",
79-
"time": "5m"
80-
},
81-
...
82-
],
82+
```json
83+
{
84+
"inventory": {
85+
"cpu": [
86+
{
87+
"core": "core1",
88+
"core_id": "core1",
89+
"load": "43",
90+
"time": "5m"
91+
},
8392
...
84-
"temperature": [
85-
{
86-
"crit": "100.000000",
87-
"label": "Core 1",
88-
"max": "100.000000",
89-
"min": "0.000000",
90-
"name": "coretemp",
91-
"path": "/sys/class/hwmon/hwmon5/temp3_input",
92-
"temperature": "44.000000"
93-
}
94-
],
95-
"uptime": [
96-
{
97-
"boot": "2023-12-04 07:16:01",
98-
"uptime": "8d 09:07h",
99-
"uptime_value": "724072.8"
100-
}
101-
]
102-
},
103-
"localtime": 1702398235
104-
}
93+
],
94+
...
95+
"temperature": [
96+
{
97+
"crit": "100.000000",
98+
"label": "Core 1",
99+
"max": "100.000000",
100+
"min": "0.000000",
101+
"name": "coretemp",
102+
"path": "/sys/class/hwmon/hwmon5/temp3_input",
103+
"temperature": "44.000000"
104+
}
105+
],
106+
"uptime": [
107+
{
108+
"boot": "2023-12-04 07:16:01",
109+
"uptime": "8d 09:07h",
110+
"uptime_value": "724072.8"
111+
}
112+
]
113+
},
114+
"localtime": 1702398235
115+
}
116+
```
105117

106118
### /api/v1/inventory/{module}
107119

@@ -110,10 +122,12 @@ are the keys from the inventory hash map as returned from `/api/v1/inventory`.
110122

111123
Example:
112124

113-
curl \
114-
-u user:changeme \
115-
-X POST \
116-
https://127.0.0.1:8443/api/v1/inventory/memory
125+
```bash
126+
curl \
127+
-u user:changeme \
128+
-X POST \
129+
https://127.0.0.1:8443/api/v1/inventory/memory
130+
```
117131

118132
## Prometheus Endpoints
119133

@@ -139,13 +153,13 @@ These endpoints are available if the `ExporterExporterServer` is enabled in the
139153

140154
### /list
141155

142-
Used by the [ExporterExporer](../prometheus/exporter/) server.
156+
Used by the [ExporterExporter](../prometheus/exporter/) server.
143157

144158
Returns list of exporters.
145159

146160
### /proxy
147161

148-
Used by the [ExporterExporer](../prometheus/exporter/) server.
162+
Used by the [ExporterExporter](../prometheus/exporter/) server.
149163

150164
Returns metrics for given exporter.
151165

@@ -166,14 +180,18 @@ Reload the configuration.
166180

167181
Example:
168182

169-
curl \
170-
-u user:changeme \
171-
-X POST \
172-
https://127.0.0.1:8443/api/v1/admin/reload
183+
```bash
184+
curl \
185+
-u user:changeme \
186+
-X POST \
187+
https://127.0.0.1:8443/api/v1/admin/reload
188+
```
173189

174190
Returns
175191

176-
{"success":true}
192+
```json
193+
{"success":true}
194+
```
177195

178196
### /api/v1/admin/certs/replace
179197

@@ -183,46 +201,54 @@ The certificates need to be base64 encoded as in the following example.
183201

184202
Example:
185203

186-
curl \
187-
-u user:changeme \
188-
-d '{ "certdata": "'$(base64 -w 0 ./server.crt)'", "keydata": "'$(base64 -w 0 dist/server.key)'", "reload": true }' \
189-
https://127.0.0.1:8443/api/v1/admin/certs/replace
204+
```bash
205+
curl \
206+
-u user:changeme \
207+
-d '{ "certdata": "'$(base64 -w 0 ./server.crt)'", "keydata": "'$(base64 -w 0 dist/server.key)'", "reload": true }' \
208+
https://127.0.0.1:8443/api/v1/admin/certs/replace
209+
```
190210

191211
Returns
192212

193-
{"success":true}
213+
```json
214+
{"success":true}
215+
```
194216

195217
### /api/v1/admin/csr
196218

197-
Request a new csr, creates new private key if requested by the user or uses the alreaday existing one
198-
The Only Field that needs to be set is CommonName the rest of the fiields is optional
219+
Request a new csr, creates new private key if requested by the user or uses the already existing one.
220+
The only field that needs to be set is `CommonName` the rest of the fields is optional.
199221

200222
Example:
201223

202-
curl \
203-
-u user:changeme \
204-
-d '{"Country":"DE","State":"Bavaria","Locality":"Earth","Organization":"snclient","OrganizationalUnit":"IT","HostName":"Root CA SNClient", "NewKey":true, "KeyLength":4096}' \
205-
https://127.0.0.1:8443/api/v1/admin/csr
206-
207-
Returns
224+
```bash
225+
curl \
226+
-u user:changeme \
227+
-d '{"Country":"DE","State":"Bavaria","Locality":"Earth","Organization":"snclient","OrganizationalUnit":"IT","HostName":"Root CA SNClient", "NewKey":true, "KeyLength":4096}' \
228+
https://127.0.0.1:8443/api/v1/admin/csr
229+
```
208230

209-
PEM Encoded CSR
231+
Returns PEM encoded csr
210232

211233
### /api/v1/admin/updates/install
212234

213235
Trigger checking for updates.
214236

215237
Example:
216238

217-
curl \
218-
-u user:changeme \
219-
-X POST \
220-
https://127.0.0.1:8443/api/v1/admin/updates/install
239+
```bash
240+
curl \
241+
-u user:changeme \
242+
-X POST \
243+
https://127.0.0.1:8443/api/v1/admin/updates/install
244+
```
221245

222246
Returns
223247

224-
{
225-
"success": true,
226-
"message": "update found and installed",
227-
"version": "v0.27.0024"
228-
}
248+
```json
249+
{
250+
"success": true,
251+
"message": "update found and installed",
252+
"version": "v0.27.0024"
253+
}
254+
```

0 commit comments

Comments
 (0)