How to add new user with command line? or even to change user password with command line?

Seems I found solution. Just little reverse engineered onboarding process with browser developer tools. Hope this helps for someone.

For create user you could do:

curl --location --request POST 'http://192.168.1.1:8123/api/onboarding/users' \
--header 'Content-Type: application/json' \
--data-raw '{
    "client_id": "http://192.168.1.1:8123/",
    "name": "admin",
    "username": "admin",
    "password": "12345",
    "language": "en"
}'

or same on python:

import requests
import json

url = "http://192.168.1.42:8124/api/onboarding/users"

payload = json.dumps({
  "client_id": "http://192.168.1.42:8123/",
  "name": "admin",
  "username": "admin",
  "password": "12345",
  "language": "en"
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

IP in client_id match to exposed IP. But I don’t test another options.

Next step for me is trying to create long live tokens via curl.

2 Likes