Allsky Server API¶
The Allsky Server is a separate process that runs alongside Allsky its primary job is to handle longer running processes and to manage GPIO Coontrol. Its core functions are:
- The Allsky dashboard whcich displays information about Allsky - currently under development.
- The Allsky focuser which allows a camera with a focus motor to be focused - currently under development.
- The Pi's GPIO pins, both digital and PWM.
Authentication¶
The API requires authentication under the following circumstances.
- You are unsing the inbuilt Dashboard, in this case the authentication will be via a login screen using the same login and password as Allaky.
- You are using the api from an external machine. In this case you will need to request a JWT token from the API.
If you are using the API from the local machine then no authentication is required for any API.
Requesting a JWT token¶
To get a JWT token use the following API endpoint.
POST /login
This expects a username and password and returns a JWT token.
TODO: Add Hoppscotch examples TODO: Creating users
The Available API's¶
allsky
¶
allsky_status()
¶
GET /allsky/status
Retrieve the current Allsky system status.
This endpoint queries backend logic (get_allsky_status) and returns a full status dictionary, plus a rendered HTML fragment used by the web frontend.
Authentication
Requires: api_auth_required("allsky", "read")
Returns:
| Name | Type | Description |
|---|---|---|
dict |
A JSON object containing:
- All fields provided by |
Source code in modules/allsky/__init__.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
restart_allsky()
¶
GET /allsky/restart
Restart the Allsky service.
Authentication
Requires: api_auth_required("allsky", "update")
Returns:
| Name | Type | Description |
|---|---|---|
JSON |
|
Source code in modules/allsky/__init__.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
start_allsky()
¶
GET /allsky/start
Start the Allsky service.
Authentication
Requires: api_auth_required("allsky", "update")
Returns:
| Name | Type | Description |
|---|---|---|
JSON |
|
Source code in modules/allsky/__init__.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
stop_allsky()
¶
GET /allsky/stopallsky
Stop the Allsky service and immediately start the AllskyServer service.
This is commonly used during debugging or maintenance when the capture component needs to be restarted but the web interface should remain active.
Authentication
Requires: api_auth_required("allsky", "update")
Returns:
| Name | Type | Description |
|---|---|---|
JSON |
|
Source code in modules/allsky/__init__.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
stop_allsky_all()
¶
GET /allsky/stopall
Stop the Allsky service.
This fully stops the "allsky" systemd service.
Authentication
Requires: api_auth_required("allsky", "update")
Returns:
| Name | Type | Description |
|---|---|---|
JSON |
|
Source code in modules/allsky/__init__.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
gpio
¶
get_gpio_backend()
¶
Lazily select a GPIO backend.
Source code in modules/gpio/__init__.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
get_gpio_count()
¶
Return the number of GPIO lines exposed by the active backend.
Source code in modules/gpio/__init__.py
41 42 43 44 45 | |
get_gpio_status()
¶
Inspect all available GPIO lines and return their current usage.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Status for each Dxx pin on the board. |
Source code in modules/gpio/__init__.py
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 | |
normalise_pin(gpio_str)
¶
Validate and normalise a GPIO pin number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gpio_str
|
str | int
|
Pin number, e.g. "18". |
required |
Returns:
| Type | Description |
|---|---|
|
tuple[str, int]: String form and integer form of the GPIO number. |
Source code in modules/gpio/__init__.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |