Endurance

Users

The local user accounts that can log into the appliance and use the API.

Current token

GET /localUsers/current

Get your own user account

curl
curl -X GET "https://appliance.example.com/api/v1/localUsers/current" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/localUsers/current';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.get("https://appliance.example.com/api/v1/localUsers/current", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/localUsers/current', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Response
{
  "status": "success",
  "message": "Current user",
  "data": {
    "email": "test-test@loadbalancer.org",
    "firstName": "Test Test",
    "lastName": "Test"
  }
}

PUT /localUsers/current

Update your own user account

This change is staged. Send PUT /services/apply to apply it.

Body parameters
email string Required
firstname string Required
lastname string Required
password string Required
curl
curl -X PUT "https://appliance.example.com/api/v1/localUsers/current" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "<email>",
  "firstname": "<firstname>",
  "lastname": "<lastname>",
  "password": "<password>"
}'
PHP
<?php

$url = 'https://appliance.example.com/api/v1/localUsers/current';
$headers = [
    'Authorization: Bearer ' . $token,
    'Content-Type: application/json',
];

$payload = [
    'email' => '<email>',
    'firstname' => '<firstname>',
    'lastname' => '<lastname>',
    'password' => '<password>',
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => json_encode($payload),
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}
payload = {
    "email": "<email>",
    "firstname": "<firstname>",
    "lastname": "<lastname>",
    "password": "<password>"
}

response = requests.put("https://appliance.example.com/api/v1/localUsers/current", headers=headers, json=payload)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/localUsers/current', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${token}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "email": "<email>",
  "firstname": "<firstname>",
  "lastname": "<lastname>",
  "password": "<password>"
}),
});

const data = await response.json();
Response
{
  "status": "success",
  "message": "Your information has been updated"
}

Update a user

PUT /localUsers/users/{id}

Edit a User

This change is staged. Send PUT /services/apply to apply it.

Path parameters
id string Required

The id of the user.

Body parameters
email string Required
firstname string Required
lastname string Required
password string Required
disabled string default: "false"
groups array
roles array
curl
curl -X PUT "https://appliance.example.com/api/v1/localUsers/users/{id}" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "<email>",
  "firstname": "<firstname>",
  "lastname": "<lastname>",
  "password": "<password>",
  "disabled": "false",
  "groups": [
    "<groups>"
  ],
  "roles": [
    "<roles>"
  ]
}'
PHP
<?php

$url = 'https://appliance.example.com/api/v1/localUsers/users/{id}';
$headers = [
    'Authorization: Bearer ' . $token,
    'Content-Type: application/json',
];

$payload = [
    'email' => '<email>',
    'firstname' => '<firstname>',
    'lastname' => '<lastname>',
    'password' => '<password>',
    'disabled' => 'false',
    'groups' => [
        '<groups>',
    ],
    'roles' => [
        '<roles>',
    ],
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => json_encode($payload),
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}
payload = {
    "email": "<email>",
    "firstname": "<firstname>",
    "lastname": "<lastname>",
    "password": "<password>",
    "disabled": "false",
    "groups": [
        "<groups>"
    ],
    "roles": [
        "<roles>"
    ]
}

response = requests.put("https://appliance.example.com/api/v1/localUsers/users/{id}", headers=headers, json=payload)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/localUsers/users/{id}', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${token}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "email": "<email>",
  "firstname": "<firstname>",
  "lastname": "<lastname>",
  "password": "<password>",
  "disabled": "false",
  "groups": [
    "<groups>"
  ],
  "roles": [
    "<roles>"
  ]
}),
});

const data = await response.json();
Response
{
  "status": "success",
  "message": "User edited"
}

Current token (/userExtras/current)

GET /userExtras/current

Get the current user’s Extras (WebUI preferences). When no preferences have been saved yet, the response serializes "extras" as [] (an empty JSON array), not {}.

curl
curl -X GET "https://appliance.example.com/api/v1/userExtras/current" \
  -H "Authorization: Bearer $TOKEN"
PHP
<?php

$url = 'https://appliance.example.com/api/v1/userExtras/current';
$headers = [
    'Authorization: Bearer ' . $token,
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}

response = requests.get("https://appliance.example.com/api/v1/userExtras/current", headers=headers)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/userExtras/current', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${token}`,
  },
});

const data = await response.json();
Response
{
  "status": "success",
  "message": "Your Extras",
  "data": {
    "extras": {
      "menuFloats": true,
      "codeEditorDarkTheme": true
    }
  }
}

PUT /userExtras/current

Replace the current user’s Extras. Keys must match [A-Za-z0-9_]{1,64}; values must be string/bool/number/null. Sending an empty object {} clears all stored Extras.

This change is staged. Send PUT /services/apply to apply it.

Body parameters
extras object Required

Flat map of preference key/value pairs.

curl
curl -X PUT "https://appliance.example.com/api/v1/userExtras/current" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "extras": {}
}'
PHP
<?php

$url = 'https://appliance.example.com/api/v1/userExtras/current';
$headers = [
    'Authorization: Bearer ' . $token,
    'Content-Type: application/json',
];

$payload = [
    'extras' => [],
];

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => json_encode($payload),
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
Python
import requests

headers = {"Authorization": f"Bearer {token}"}
payload = {
    "extras": {}
}

response = requests.put("https://appliance.example.com/api/v1/userExtras/current", headers=headers, json=payload)
response.raise_for_status()
print(response.json())
JavaScript
const response = await fetch('https://appliance.example.com/api/v1/userExtras/current', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${token}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "extras": {}
}),
});

const data = await response.json();
Response
{
  "status": "success",
  "message": "Your Extras have been updated"
}