-
Notifications
You must be signed in to change notification settings - Fork 0
/
webapi_spec.html
484 lines (481 loc) · 20.2 KB
/
webapi_spec.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
<!doctype html>
<html>
<head>
<title>ESP8266X2PAV API</title>
<style type="text/css">
body {
color: #223;
background-color: #dde;
}
h5 {
font-size: 1em;
font-weight: normal;
font-style: italic;
}
h5[class*=" response-2"] {
color: green;
}
h5[class*=" response-4"], h5[class*=" response-5"] {
color: red;
}
.app-desc {
clear: both;
margin-left: 20px;
}
.param-name {
width: 100%;
}
.license-info {
margin-left: 20px;
}
.model {
margin: 0 0 0px 20px;
}
.method {
margin-left: 20px;
}
.method-notes {
font-size: large;
margin: 10px 0;
}
pre {
padding: 10px;
margin-bottom: 2px;
}
.http-method {
text-transform: uppercase;
}
pre.get {
background-color: #17b;
}
pre.post {
background-color: #1a5;
}
pre.put {
background-color: #c83;
}
pre.delete {
background-color: #a22;
}
.huge {
color: #fff;
}
pre.example {
background-color: #eee;
padding: 10px;
border: 1px solid #ddd;
}
code {
font-family: Consolas, monospace;
white-space: pre;
}
.nickname {
font-weight: bold;
}
.method-path {
font-size: x-large;
font-weight: bold;
}
.up {
text-decoration: none;
float:right;
}
.param {
color: #337;
padding: 10px 0 0 20px;
font-weight: bold;
}
.param-desc, .response-desc {
padding: 0 0 0 20px;
}
.param-type {
font-style: italic;
}
.param-enum-header {
padding: 0 0 0 60px;
font-weight: bold;
}
.param-enum {
padding: 0 0 0 80px;
font-style: italic;
}
.field-label {
color: #55a;
padding: 0;
margin: 0;
clear: both;
}
.field-items {
padding: 0 0 15px 0;
margin-bottom: 15px;
}
.consume-content-type, .produce-content-type, .return-type {
clear: both;
padding-bottom: 10px;
}
.param-header {
font-weight: bold;
}
.method-tags {
text-align: right;
}
.method-tag {
background: none repeat scroll 0% 0% #2a0;
border-radius: 3px;
padding: 2px 10px;
margin: 2px;
color: #fff;
display: inline-block;
text-decoration: none;
}
</style>
</head>
<body>
<h1>ESP8266X2PAV API</h1>
<div class="app-desc">This is Web API specification of <strong>ESP8266X2PAV</strong> which is a 16×16-dotted pixel art viewer with ESP-WROOM-02 and Unicorn HAT HD.</div>
<div class="app-desc">Version: 0.1.0</div>
<div class="app-desc">BasePath: http://esp8266x2pav.local:8080/api</div>
<div class="license-info">License: <a href="https://github.com/obono/ESP8266X2PAV/blob/main/LICENSE" target="_blank">MIT License</a></div>
<hr/>
<h2><a name="__Methods">Methods</a></h2>
<h3>Table of Contents </h3>
<div class="method-summary"></div>
<h4><a href="#Configuration">Configuration</a></h4>
<ul>
<li><a href="#configsActiveDurationGet"><code><span class="http-method">get</span> /configs/active_duration</code></a></li>
<li><a href="#configsActiveDurationPut"><code><span class="http-method">put</span> /configs/active_duration</code></a></li>
<li><a href="#configsLeastDurationGet"><code><span class="http-method">get</span> /configs/least_duration</code></a></li>
<li><a href="#configsLeastDurationPut"><code><span class="http-method">put</span> /configs/least_duration</code></a></li>
<li><a href="#configsLeastLoopGet"><code><span class="http-method">get</span> /configs/least_loop</code></a></li>
<li><a href="#configsLeastLoopPut"><code><span class="http-method">put</span> /configs/least_loop</code></a></li>
</ul>
<h4><a href="#Execution">Execution</a></h4>
<ul>
<li><a href="#execClearPut"><code><span class="http-method">put</span> /exec/clear</code></a></li>
<li><a href="#execDisplayNamePut"><code><span class="http-method">put</span> /exec/display/{name}</code></a></li>
<li><a href="#execDrawPut"><code><span class="http-method">put</span> /exec/draw</code></a></li>
<li><a href="#execForwardArtPut"><code><span class="http-method">put</span> /exec/forward_art</code></a></li>
<li><a href="#execFreezePut"><code><span class="http-method">put</span> /exec/freeze</code></a></li>
</ul>
<h4><a href="#Others">Others</a></h4>
<ul>
<li><a href="#versionGet"><code><span class="http-method">get</span> /version</code></a></li>
</ul>
<h4><a href="#PixelArt">PixelArt</a></h4>
<ul>
<li><a href="#artsGet"><code><span class="http-method">get</span> /arts</code></a></li>
<li><a href="#artsNameDelete"><code><span class="http-method">delete</span> /arts/{name}</code></a></li>
<li><a href="#artsNameGet"><code><span class="http-method">get</span> /arts/{name}</code></a></li>
<li><a href="#artsPost"><code><span class="http-method">post</span> /arts</code></a></li>
</ul>
<h4><a href="#Status">Status</a></h4>
<ul>
<li><a href="#statusCurrentArtGet"><code><span class="http-method">get</span> /status/current_art</code></a></li>
<li><a href="#statusPixelsGet"><code><span class="http-method">get</span> /status/pixels</code></a></li>
</ul>
<hr/>
<h3><a name="Configuration">Configuration</a></h3>
<div class="method"><a name="configsActiveDurationGet"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="get"><code class="huge"><span class="http-method">get</span> /configs/active_duration</code></pre></div>
<div class="method-notes">Get the active duration</div>
<h4 class="field-label">Produces</h4>
<div class="produce-content-type">plain/text</div>
<h4 class="field-label">Return type</h4>
<div class="return-type">Integer</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-200">200</h5>
<div class="response-desc">The active duration (secs) <a href="#Integer">Integer</a></div>
</div>
<hr/>
<div class="method"><a name="configsActiveDurationPut"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="put"><code class="huge"><span class="http-method">put</span> /configs/active_duration</code></pre></div>
<div class="method-notes">Set the active duration</div>
<h4 class="field-label">Consumes</h4>
<div class="produce-content-type">plain/text</div>
<h4 class="field-label">Request body</h4>
<div class="field-items">
<div class="param">body <a href="#integer">integer</a> (required)</div>
<div class="param-desc"><span class="param-type">Body Parameter</span> — The active duration (60~3600)</div>
</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-204">204</h5>
<div class="response-desc">Success <a href="#"></a></div>
<h5 class="field-label response-400">400</h5>
<div class="response-desc">Bad request <a href="#"></a></div>
</div>
<hr/>
<div class="method"><a name="configsLeastDurationGet"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="get"><code class="huge"><span class="http-method">get</span> /configs/least_duration</code></pre></div>
<div class="method-notes">Get the least duration</div>
<h4 class="field-label">Produces</h4>
<div class="produce-content-type">plain/text</div>
<h4 class="field-label">Return type</h4>
<div class="return-type">Integer</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-200">200</h5>
<div class="response-desc">The least duration (secs) <a href="#Integer">Integer</a></div>
</div>
<hr/>
<div class="method"><a name="configsLeastDurationPut"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="put"><code class="huge"><span class="http-method">put</span> /configs/least_duration</code></pre></div>
<div class="method-notes">Set the least duration</div>
<h4 class="field-label">Consumes</h4>
<div class="produce-content-type">plain/text</div>
<h4 class="field-label">Request body</h4>
<div class="field-items">
<div class="param">body <a href="#integer">integer</a> (required)</div>
<div class="param-desc"><span class="param-type">Body Parameter</span> — The least duration (1~120)</div>
</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-204">204</h5>
<div class="response-desc">Success <a href="#"></a></div>
<h5 class="field-label response-400">400</h5>
<div class="response-desc">Bad request <a href="#"></a></div>
</div>
<hr/>
<div class="method"><a name="configsLeastLoopGet"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="get"><code class="huge"><span class="http-method">get</span> /configs/least_loop</code></pre></div>
<div class="method-notes">Get the least loop times</div>
<h4 class="field-label">Produces</h4>
<div class="produce-content-type">plain/text</div>
<h4 class="field-label">Return type</h4>
<div class="return-type">Integer</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-200">200</h5>
<div class="response-desc">The least loop times <a href="#Integer">Integer</a></div>
</div>
<hr/>
<div class="method"><a name="configsLeastLoopPut"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="put"><code class="huge"><span class="http-method">put</span> /configs/least_loop</code></pre></div>
<div class="method-notes">Set the least loop times</div>
<h4 class="field-label">Consumes</h4>
<div class="produce-content-type">plain/text</div>
<h4 class="field-label">Request body</h4>
<div class="field-items">
<div class="param">body <a href="#integer">integer</a> (required)</div>
<div class="param-desc"><span class="param-type">Body Parameter</span> — The least loop times (0~5)</div>
</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-204">204</h5>
<div class="response-desc">Success <a href="#"></a></div>
<h5 class="field-label response-400">400</h5>
<div class="response-desc">Bad request <a href="#"></a></div>
</div>
<hr/>
<h3><a name="Execution">Execution</a></h3>
<div class="method"><a name="execClearPut"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="put"><code class="huge"><span class="http-method">put</span> /exec/clear</code></pre></div>
<div class="method-notes">Clear the display</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-204">204</h5>
<div class="response-desc">Success <a href="#"></a></div>
</div>
<hr/>
<div class="method"><a name="execDisplayNamePut"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="put"><code class="huge"><span class="http-method">put</span> /exec/display/{name}</code></pre></div>
<div class="method-notes">Display a pixel art</div>
<h4 class="field-label">Path parameters</h4>
<div class="field-items">
<div class="param">name (required)</div>
<div class="param-desc"><span class="param-type">Path Parameter</span> — The name of pixel art</div>
</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-204">204</h5>
<div class="response-desc">Success <a href="#"></a></div>
<h5 class="field-label response-404">404</h5>
<div class="response-desc">Not found <a href="#"></a></div>
</div>
<hr/>
<div class="method"><a name="execDrawPut"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="put"><code class="huge"><span class="http-method">put</span> /exec/draw</code></pre></div>
<div class="method-notes">Draw pixels on the display</div>
<h4 class="field-label">Consumes</h4>
<div class="produce-content-type">plain/text</div>
<h4 class="field-label">Request body</h4>
<div class="field-items">
<div class="param">body <a href="#string">string</a> (required)</div>
<div class="param-desc"><span class="param-type">Body Parameter</span> — <p>Base64 encoded binary data of the drawing instruction</p>
<ul>
<li>Byte 1~3: The color information (R, G, B).</li>
<li>Byte 4~: The position to draw pixel (lower 4 bits for X, upper 4 bits for Y).</li>
</ul>
</div>
</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-204">204</h5>
<div class="response-desc">Success <a href="#"></a></div>
<h5 class="field-label response-400">400</h5>
<div class="response-desc">Bad request <a href="#"></a></div>
<h5 class="field-label response-403">403</h5>
<div class="response-desc">Forbidden <a href="#"></a></div>
</div>
<hr/>
<div class="method"><a name="execForwardArtPut"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="put"><code class="huge"><span class="http-method">put</span> /exec/forward_art</code></pre></div>
<div class="method-notes">Forward to next pixel art</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-204">204</h5>
<div class="response-desc">Success <a href="#"></a></div>
</div>
<hr/>
<div class="method"><a name="execFreezePut"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="put"><code class="huge"><span class="http-method">put</span> /exec/freeze</code></pre></div>
<div class="method-notes">Freeze the display</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-204">204</h5>
<div class="response-desc">Success <a href="#"></a></div>
</div>
<hr/>
<h3><a name="Others">Others</a></h3>
<div class="method"><a name="versionGet"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="get"><code class="huge"><span class="http-method">get</span> /version</code></pre></div>
<div class="method-notes">Get the firmware version</div>
<h4 class="field-label">Produces</h4>
<div class="produce-content-type">plain/text</div>
<h4 class="field-label">Return type</h4>
<div class="return-type">String</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-200">200</h5>
<div class="response-desc">The firmware version <a href="#String">String</a></div>
</div>
<hr/>
<h3><a name="PixelArt">PixelArt</a></h3>
<div class="method"><a name="artsGet"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="get"><code class="huge"><span class="http-method">get</span> /arts</code></pre></div>
<div class="method-notes">Get the name list of pixel arts</div>
<h4 class="field-label">Produces</h4>
<div class="produce-content-type">plain/text</div>
<h4 class="field-label">Return type</h4>
<div class="return-type">String</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-200">200</h5>
<div class="response-desc">The name list of pixel arts <a href="#String">String</a></div>
</div>
<hr/>
<div class="method"><a name="artsNameDelete"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="delete"><code class="huge"><span class="http-method">delete</span> /arts/{name}</code></pre></div>
<div class="method-notes">Delete a pixel art</div>
<h4 class="field-label">Path parameters</h4>
<div class="field-items">
<div class="param">name (required)</div>
<div class="param-desc"><span class="param-type">Path Parameter</span> — The name of pixel art</div>
</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-204">204</h5>
<div class="response-desc">Success <a href="#"></a></div>
<h5 class="field-label response-404">404</h5>
<div class="response-desc">Not found <a href="#"></a></div>
</div>
<hr/>
<div class="method"><a name="artsNameGet"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="get"><code class="huge"><span class="http-method">get</span> /arts/{name}</code></pre></div>
<div class="method-notes">Get data of a pixel art</div>
<h4 class="field-label">Path parameters</h4>
<div class="field-items">
<div class="param">name (required)</div>
<div class="param-desc"><span class="param-type">Path Parameter</span> — The name of pixel art</div>
</div>
<h4 class="field-label">Produces</h4>
<div class="produce-content-type">image/gif</div>
<h4 class="field-label">Return type</h4>
<div class="return-type">Object</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-200">200</h5>
<div class="response-desc">GIF-formatted raw binary data of a pixel art <a href="#Object">Object</a></div>
<h5 class="field-label response-404">404</h5>
<div class="response-desc">Not found <a href="#"></a></div>
</div>
<hr/>
<div class="method"><a name="artsPost"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="post"><code class="huge"><span class="http-method">post</span> /arts</code></pre></div>
<div class="method-notes">Upload data of a new pixel art</div>
<h4 class="field-label">Consumes</h4>
<div class="produce-content-type">multipart/form-data</div>
<h4 class="field-label">Form parameters</h4>
<div class="field-items">
<div class="param">filename (required)</div>
<div class="param-desc"><span class="param-type">Form Parameter</span> — </div>
<div class="param">file (required)</div>
<div class="param-desc"><span class="param-type">Form Parameter</span> — </div>
</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-204">204</h5>
<div class="response-desc">Success <a href="#"></a></div>
<h5 class="field-label response-400">400</h5>
<div class="response-desc">Bad request <a href="#"></a></div>
<h5 class="field-label response-413">413</h5>
<div class="response-desc">Too Large data <a href="#"></a></div>
<h5 class="field-label response-507">507</h5>
<div class="response-desc">Storage full <a href="#"></a></div>
</div>
<hr/>
<h3><a name="Status">Status</a></h3>
<div class="method"><a name="statusCurrentArtGet"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="get"><code class="huge"><span class="http-method">get</span> /status/current_art</code></pre></div>
<div class="method-notes">Get the name of current displayed pixel art</div>
<h4 class="field-label">Produces</h4>
<div class="produce-content-type">plain/text</div>
<h4 class="field-label">Return type</h4>
<div class="return-type">String</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-200">200</h5>
<div class="response-desc">The name of pixel art <a href="#String">String</a></div>
</div>
<hr/>
<div class="method"><a name="statusPixelsGet"/>
<div class="method-path">
<a class="up" href="#__Methods">△</a>
<pre class="get"><code class="huge"><span class="http-method">get</span> /status/pixels</code></pre></div>
<div class="method-notes">Get the pixels data of current displayed image</div>
<h4 class="field-label">Produces</h4>
<div class="produce-content-type">plain/text</div>
<h4 class="field-label">Return type</h4>
<div class="return-type">String</div>
<h4 class="field-label">Responses</h4>
<h5 class="field-label response-200">200</h5>
<div class="response-desc"><p>Base64 encoded binary data of the pixels</p>
<ul>
<li>It's concatenated pixels starting in the upper left corner, going from left to right, and then row by row going to lower.</li>
<li>Each pixel consists of 3 bytes (R, G, B), therefore it's always 768 bytes.</li>
</ul>
<a href="#String">String</a></div>
<h5 class="field-label response-403">403</h5>
<div class="response-desc">Forbidden <a href="#"></a></div>
</div>
<hr/>
</body>
</html>