Content update

This commit is contained in:
2026-02-27 10:55:24 +07:00
parent 3b1d18b001
commit 9b3e813327
53 changed files with 1549 additions and 698 deletions
+4
View File
@@ -0,0 +1,4 @@
# HTTP API
This folder documents the HTTP API. The contents of this is not included in the
printed book version.
+76
View File
@@ -0,0 +1,76 @@
= HTTP API
== Authorization
The API uses the `Authorization` header with a 16 characters long bearer token.
An example of the header would be:
```
Authorization: Bearer tC8UMiiyaLnVWaW2
```
The token is generated from a set of characters:
```
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
```
Which means you can also create a mock token by using the following code:
```py
import string
import random
s = string.ascii_letters + string.digits
for i in range(16):
print(random.choice(s), end="")
print()
```
== [GET] /api/status
Example response:
```json
{
"nfc": true
}
```
== [GET] /api/restart
Requires auth
== [GET] /api/factoryReset
Requires auth
== [GET] /api/logs
Requires auth
Returns a JSON array
Example:
```json
[
{
"time": "2026-02-03T18:48:50Z",
"uid": "b1c3600"
}
]
```
== [GET] /api/getToken
Retrieves the authentication token. _Only available in initial device setup._
If the token has already been retrieved (initial setup has been done), This
endpoint will return 403 Forbidden.
Returns `text/plain` with the 16 characters token