Endurance

Users

Updated

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

Current token

Get your own user account

GET /localUsers/current

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();
Bruno
meta {
  name: Get your own user account
  type: http
  seq: 1
}

get {
  url: https://{{node-0}}:{{port}}/api/v1/localUsers/current
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}
Response
{
  "status": "success",
  "message": "Current user",
  "data": {
    "email": "test-test@loadbalancer.org",
    "firstName": "Test Test",
    "lastName": "Test"
  }
}

Update your own user account

PUT /localUsers/current

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

Body parameters
email string Required
firstname string Required
lastname string Required
password string

A secret: never returned, so GET always reads an empty string. Leave it out to keep the stored password. An empty string is refused.

currentPassword string

Your current password. Required, and must be correct, to change your email (your login name) or your password.

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>",
  "currentPassword": "<currentPassword>"
}'
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>',
    'currentPassword' => '<currentPassword>',
];

$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>",
    "currentPassword": "<currentPassword>"
}

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>",
  "currentPassword": "<currentPassword>"
}),
});

const data = await response.json();
Bruno
meta {
  name: Update your own user account
  type: http
  seq: 1
}

put {
  url: https://{{node-0}}:{{port}}/api/v1/localUsers/current
  body: json
  auth: bearer
}

headers {
  Content-Type: application/json
}

auth:bearer {
  token: {{token}}
}

body:json {
  {
    "email": "<email>",
    "firstname": "<firstname>",
    "lastname": "<lastname>",
    "password": "<password>",
    "currentPassword": "<currentPassword>"
  }
}
Response
{
  "status": "success",
  "message": "Your information has been updated"
}

Update a user

Edit a user. Refused with a 400 if it would leave no enabled local user who can edit users and roles, or would remove your own access to do so. Refused while a transaction is open. Commit or roll back the transaction first.

PUT /localUsers/users/{id}

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

A secret: never returned, so GET always reads an empty string. Leave it out to keep the stored password. An empty string is refused.

currentPassword string

Your current password. Required, and must be correct, to change your own email or password; not needed to change another user’s.

disabled string default: "false"

Disabling the last enabled local user who can edit users and roles, or yourself, is refused.

groups array

The ids of the groups the user belongs to. Leave it out, or send null, to keep them; an empty list removes them all. A change that would leave no enabled local user able to edit users and roles, or that removes your own access to do so, is refused.

roles array

The ids of the roles given to the user directly. Leave it out, or send null, to keep them; an empty list removes them all. Refused on the same terms as groups.

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>",
  "currentPassword": "<currentPassword>",
  "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>',
    'currentPassword' => '<currentPassword>',
    '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>",
    "currentPassword": "<currentPassword>",
    "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>",
  "currentPassword": "<currentPassword>",
  "disabled": "false",
  "groups": [
    "<groups>"
  ],
  "roles": [
    "<roles>"
  ]
}),
});

const data = await response.json();
Bruno
meta {
  name: Update a user
  type: http
  seq: 1
}

put {
  url: https://{{node-0}}:{{port}}/api/v1/localUsers/users/{id}
  body: json
  auth: bearer
}

headers {
  Content-Type: application/json
}

auth:bearer {
  token: {{token}}
}

body:json {
  {
    "email": "<email>",
    "firstname": "<firstname>",
    "lastname": "<lastname>",
    "password": "<password>",
    "currentPassword": "<currentPassword>",
    "disabled": "false",
    "groups": [
      "<groups>"
    ],
    "roles": [
      "<roles>"
    ]
  }
}
Response
{
  "status": "success",
  "message": "User edited"
}

Current token (/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 {}.

GET /userExtras/current

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();
Bruno
meta {
  name: Get your own user preferences
  type: http
  seq: 1
}

get {
  url: https://{{node-0}}:{{port}}/api/v1/userExtras/current
  body: none
  auth: bearer
}

auth:bearer {
  token: {{token}}
}
Response
{
  "status": "success",
  "message": "Your Extras",
  "data": {
    "extras": {
      "menuFloats": true,
      "codeEditorDarkTheme": true
    }
  }
}

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.

PUT /userExtras/current

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();
Bruno
meta {
  name: Update your own user preferences
  type: http
  seq: 1
}

put {
  url: https://{{node-0}}:{{port}}/api/v1/userExtras/current
  body: json
  auth: bearer
}

headers {
  Content-Type: application/json
}

auth:bearer {
  token: {{token}}
}

body:json {
  {
    "extras": {}
  }
}
Response
{
  "status": "success",
  "message": "Your Extras have been updated"
}