Skip to content

Commit c32ff18

Browse files
authored
Merge pull request #302 from shantanoo-desai/master
docs: add API documentation for /diagnostics and /flows/state
2 parents ce2b8d5 + 7a7b762 commit c32ff18

File tree

4 files changed

+236
-0
lines changed

4 files changed

+236
-0
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
layout: docs-api
3+
toc: toc-api-admin.html
4+
title: GET /diagnostics
5+
slug:
6+
- url: "/docs/api/admin"
7+
label: "admin"
8+
- url: "/docs/api/admin/methods"
9+
label: "methods"
10+
- get diagnostics
11+
---
12+
13+
Get the runtime diagnostics. Note that runtime diagnostics are available only if
14+
`diagnostics` value is set to `enabled: true` in the `settings.js` file.
15+
16+
17+
Requires permission: <code>settings.read</code>
18+
19+
### Headers
20+
21+
Header | Value
22+
-------|-------
23+
`Authorization` | `Bearer [token]` - if authentication is enabled
24+
25+
### Response
26+
27+
Status Code | Reason | Response
28+
------------|----------------|--------------
29+
`200` | Success | See example response body
30+
`401` | Not authorized | _none_
31+
32+
{% highlight json %}
33+
{
34+
"report": "diagnostics",
35+
"scope": "basic",
36+
"time": {
37+
"utc": "Mon, 23 Jan 2023 20:15:08 GMT",
38+
"local": "1/23/2023, 8:15:08 PM"
39+
},
40+
"intl": {
41+
"locale": "en-US",
42+
"timeZone": "UTC"
43+
},
44+
"nodejs": {
45+
"version": "v16.16.0",
46+
"arch": "x64",
47+
"platform": "linux",
48+
"memoryUsage": {
49+
"rss": 106336256,
50+
"heapTotal": 36225024,
51+
"heapUsed": 33527912,
52+
"external": 1905248,
53+
"arrayBuffers": 145556
54+
}
55+
},
56+
"os": {
57+
"containerised": true,
58+
"wsl": false,
59+
"totalmem": 32841064448,
60+
"freemem": 28394344448,
61+
"arch": "x64",
62+
"loadavg": [
63+
1,
64+
1.01,
65+
0.89
66+
],
67+
"platform": "linux",
68+
"release": "5.15.85-1-MANJARO",
69+
"type": "Linux",
70+
"uptime": 5554.97,
71+
"version": "#1 SMP PREEMPT Wed Dec 21 21:15:06 UTC 2022"
72+
},
73+
"runtime": {
74+
"version": "3.0.2",
75+
"isStarted": true,
76+
"flows": {
77+
"state": "start",
78+
"started": true
79+
},
80+
"modules": {
81+
"node-red": "3.0.2"
82+
},
83+
"settings": {
84+
"available": true,
85+
"apiMaxLength": "UNSET",
86+
"disableEditor": false,
87+
"contextStorage": {},
88+
"debugMaxLength": 1000,
89+
"editorTheme": {
90+
"palette": {},
91+
"projects": {
92+
"enabled": false,
93+
"workflow": {
94+
"mode": "manual"
95+
}
96+
},
97+
"codeEditor": {
98+
"lib": "ace",
99+
"options": {
100+
"theme": "vs"
101+
}
102+
}
103+
},
104+
"flowFile": "flows.json",
105+
"mqttReconnectTime": 15000,
106+
"serialReconnectTime": 15000,
107+
"socketReconnectTime": "UNSET",
108+
"socketTimeout": "UNSET",
109+
"tcpMsgQueueSize": "UNSET",
110+
"inboundWebSocketTimeout": "UNSET",
111+
"runtimeState": {
112+
"enabled": false,
113+
"ui": false
114+
},
115+
"adminAuth": "SET",
116+
"httpAdminRoot": "/",
117+
"httpAdminCors": "UNSET",
118+
"httpNodeAuth": "UNSET",
119+
"httpNodeRoot": "/",
120+
"httpNodeCors": "UNSET",
121+
"httpStatic": "UNSET",
122+
"httpStaticRoot": "UNSET",
123+
"httpStaticCors": "UNSET",
124+
"uiHost": "SET",
125+
"uiPort": "SET",
126+
"userDir": "SET",
127+
"nodesDir": "UNSET"
128+
}
129+
}
130+
}
131+
{% endhighlight %}
132+
133+
The response object contains the following fields:
134+
135+
Field | Description
136+
---------------|------------
137+
`intl` | The internationalization (i8n) language for the node-red instance
138+
`nodejs` | NodeJS version for underlying architecture / platform
139+
`os` | Operating System information and statistics for current memory usage
140+
`runtime` | Current Node-RED runtime information
141+
`modules` | Node-RED modules and their respective versions
142+
`settings` | Detailed description for the current settings of the node-RED instance
143+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
layout: docs-api
3+
toc: toc-api-admin.html
4+
title: GET /flows/state
5+
slug:
6+
- url: "/docs/api/admin"
7+
label: "admin"
8+
- url: "/docs/api/admin/methods"
9+
label: "methods"
10+
- get flows state
11+
---
12+
13+
Get the current runtime state of flows. Note that runtime state of flows is available only if
14+
`runtimeState` value is set to `enabled: true` in the `settings.js` file.
15+
16+
### Headers
17+
18+
Header | Value
19+
-------|-------
20+
`Authorization` | `Bearer [token]` - if authentication is enabled
21+
22+
### Response
23+
24+
Status Code | Reason | Response
25+
------------|----------------|--------------
26+
`200` | Success | See example response body
27+
`401` | Not authorized | _none_
28+
29+
{% highlight json %}
30+
{
31+
"state": "stop"
32+
}
33+
{% endhighlight %}
34+
35+
The response object contains the following fields:
36+
37+
Field | Description
38+
---------------|------------
39+
`state` | runtime state of the flows. Can be either `start` or `stop`

docs/api/admin/methods/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ slug:
1515
[<span class="method">POST</span>/auth/token](post/auth/token) | Exchange credentials for access token
1616
[<span class="method">POST</span>/auth/revoke](post/auth/revoke) | Revoke an access token
1717
[<span class="method">GET</span>/settings](get/settings) | Get the runtime settings
18+
[<span class="method">GET</span>/diagnostics](get/diagnostics) | Get the runtime diagnostics
1819
[<span class="method">GET</span>/flows](get/flows) | Get the active flow configuration
20+
[<span class="method">GET</span>/flows/state](get/flows/state) | Get the active flow's runtime state
1921
[<span class="method">POST</span>/flows](post/flows) | Set the active flow configuration
22+
[<span class="method">POST</span>/flows/state](post/flows/state) | Set the active flow's runtime state
2023
[<span class="method">POST</span>/flow](post/flow) | Add a flow to the active configuration
2124
[<span class="method">GET</span>/flow/:id](get/flow) | Get an individual flow configuration
2225
[<span class="method">PUT</span>/flow/:id](put/flow) | Update an individual flow configuration
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
layout: docs-api
3+
toc: toc-api-admin.html
4+
title: POST /flows/state
5+
slug:
6+
- url: "/docs/api/admin"
7+
label: "admin"
8+
- url: "/docs/api/admin/methods"
9+
label: "methods"
10+
- set flows state
11+
---
12+
13+
Set the runtime state of flows. Note that runtime state of flows is available only if
14+
`runtimeState` value is set to `enabled: true` in the `settings.js` file.
15+
16+
Requires permission: <code>flows.write</code>
17+
18+
### Headers
19+
20+
Header | Value
21+
-------|-------
22+
`Authorization` | `Bearer [token]` - if authentication is enabled
23+
24+
25+
### Arguments
26+
27+
The request body must be a URL-Encoded parameter with the following field:
28+
29+
30+
Field | Description
31+
-------------|------------------------
32+
`state` | Required runtime state of the flow. Can be either `start` or `stop`
33+
34+
### Response
35+
36+
Status Code | Reason | Response
37+
------------|----------------|--------------
38+
`200` | Success | See example response body
39+
`401` | Not authorized | _none_
40+
41+
{% highlight json %}
42+
{
43+
"state": "stop"
44+
}
45+
{% endhighlight %}
46+
47+
The response object contains the following fields:
48+
49+
Field | Description
50+
---------------|------------
51+
`state` | runtime state of the flows. Can be either `start` or `stop`

0 commit comments

Comments
 (0)