-
DescriptionDoes anyone have an example of using the REST API to enable the Universal Token? I've been trying to do it and the Universal Token seems to be changing between API calls 😕 I've taken a look in the Developer Tools to replicate the calls below using Ansible: - name: Create | Get Beszel Hub PocketBase API token
register: beszel_hub_api_token_resp
ansible.builtin.uri:
# https://github.com/vaphes/pocketbase/blob/master/pocketbase/services/admin_service.py#L75
url: http://localhost:8090/api/collections/_superusers/auth-with-password
method: POST
headers:
Authorization: ""
body:
identity: molecule@example.com
password: molecule
body_format: json
- name: Create | Get Beszel Universal Token
register: beszel_universal_token_resp
ansible.builtin.uri:
url: http://localhost:8090/api/beszel/universal-token
method: GET
body_format: json
headers:
Authorization: "{{ beszel_hub_api_token_resp.json.token }}"
body:
enable: -1
token: ""
- name: Create | Enable Beszel Universal Token
ansible.builtin.uri:
url: http://localhost:8090/api/beszel/universal-token
method: GET
body_format: json
headers:
Authorization: "{{ beszel_hub_api_token_resp.json.token }}"
body:
token: "{{ beszel_universal_token_resp.json.token }}"
enable: 1Here is the output from each task: In the first call to get the current token, it's OS / Architecturelinux/amd64 Beszel version0.13.0 Installation methodDocker Configuration---
services:
beszel:
image: ghcr.io/henrygd/beszel/beszel:0.13.0
container_name: beszel
restart: unless-stopped
environment:
- USER_EMAIL=molecule@example.com
- USER_PASSWORD=molecule
networks:
- beszel
ports:
- 8090:8090
volumes:
- beszel_data:/beszel_data
volumes:
beszel_data:
networks:
beszel:Hub Logs2025/10/05 11:44:48 Server started at http://0.0.0.0:8090
├─ REST API: http://0.0.0.0:8090/api/
└─ Dashboard: http://0.0.0.0:8090/_/Agent LogsNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 17 replies
-
|
Try using URL query params instead of request body. Otherwise I think this should work fine. Let me know if not. url: http://localhost:8090/api/beszel/universal-token?enable=1 |
Beta Was this translation helpful? Give feedback.
-
|
FYI - The |
Beta Was this translation helpful? Give feedback.
I did try using this Bun / TS script and it seems to work as intended. I haven't had time to try out the Ansible setup.