This project is based on PocketBase, therefore you can use their API. You can check our the documentation here: https://pocketbase.io/docs/api-records/
To get better documentation than this wiki page: login to the admin dashboard at localhost:8090/_/ and click the "API Preview" button at the top right. You should get plenty examples on all things you can do. There is also filtering and much more.
Authentication
All routes require the "Authorization" header with jwt token. You can get the jwt token like this:
Users:
- [POST]
/api/collections/users/auth-with-password
Superusers:
- [POST]
/api/collections/_superusers/auth-with-password
With body:
Some basic endpoints you might find useful:
- [GET]
/api/collections/devices/records returns first 30 devices
- [GET]
/api/collections/devices/records/:id returns single device by id
- [PATCH]
/api/collections/devices/records/:id updates single device with json body
- [DELETE]
/api/collections/devices/records/:id deletes single device by id
I've extended the default PocketBase API:
- [GET]
/api/upsnap/wake/:id wakes the device with given id
- [GET]
/api/upsnap/wakegroup/:id wakes the whole device group with given id
- [GET]
/api/upsnap/sleep/:id send device with given id to sleep using sleep-on-lan
- [GET]
/api/upsnap/reboot/:id wakes the device with given id
- [GET]
/api/upsnap/shutdown/:id shuts down the device with given id
- [GET]
/api/upsnap/scan scans the network for devices
Example bash script to wake device, run rsync and shutdown the device: