77 lines
1.1 KiB
Typst
77 lines
1.1 KiB
Typst
= 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
|
|
|