Users
The local user accounts that can log into the appliance and use the API.
Current token
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"
}
}
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
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)
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
}
}
}
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"
}