Litmus UNS/Security - LE, LEM, LUNS API Docs
Applies to: Litmus UNS (the product name for versions
<v2.0.0). This file documents the "Security" folder (MQTT account and ACL management). It is not valid for Litmus Unify 2.0.x+ -- in 2.0.x these account operations moved underMQTT/Accountsand were renamed; see /luns/mqtt.md (and its version map) for the current equivalents.
Get Accounts
POST {{uns_url}}/mqtt/gql
list of generic MQTT accounts
Request Body
GraphQL Query
query Account {
account {
clients {
id
connected
protoLevel
remote
lastSeen
}
id
username
acType
enabled
rules {
id
path
perm
}
}
}
Response
Status: 200 OK
{
"data": {
"account": [
{
"clients": null,
"id": "5ACB74CE-FFBF-43B2-87D2-E422931F6035",
"username": "ide-ui",
"acType": "General",
"enabled": true,
"rules": [
{
"id": "4F39EFA4-3A77-473C-906A-361FB2B5CB68",
"path": "bh",
"perm": "Sub"
},
{
"id": "E2FB1031-C2A8-4F65-B8B4-895F294E7295",
"path": "topicName",
"perm": "Sub"
},
{
"id": "86887A4B-E5A6-47DA-9AE6-8ABDA303DC4D",
"path": "topicName",
"perm": "Sub"
},
{
"id": "2A38CD43-DB5D-41BA-A9D7-E13CF347196F",
"path": "topicName",
"perm": "PubSub"
},
{
"id": "6F9793FB-645A-4DCE-8FD7-ABB213095A55",
"path": "topicName",
"perm": "PubSub"
}
]
},
{
"clients": null,
"id": "F5A9FA13-1781-4ADD-9C0E-D0463CCCD833",
"username": "APIclient",
"acType": "General",
"enabled": true,
"rules": null
}
]
}
}
Create Account
POST {{uns_url}}/mqtt/gql
create a new account
Request Body
GraphQL Query
mutation accountCreate($input: AccountCreateInput!) {
accountCreate(input: $input) {
password
account {
username
acType
}
}
}
Variables
{
"input": {
"username": "{{uns_account_name}}",
"acType": "General"
}
}
Response
Status: 200 OK
{
"data": {
"accountCreate": {
"password": "@A-uMa4GtC3YYMs_N",
"account": {
"username": "apiAccount",
"acType": "General"
}
}
}
}
Account Details
POST {{uns_url}}/mqtt/gql
more details of an account
Request Body
GraphQL Query
query AccountDetails($input: UUID!) {
account(id: $input) {
clients {
id
connected
protoLevel
remote
lastSeen
}
id
username
acType
enabled
rules {
id
path
perm
}
}
}
Variables
{
"input": "{{uns_account_id}}"
}
Response
Status: 200 OK
{
"data": {
"account": [
{
"clients": null,
"id": "F5A9FA13-1781-4ADD-9C0E-D0463CCCD833",
"username": "APIclient",
"acType": "General",
"enabled": true,
"rules": null
}
]
}
}
Enable Account
POST {{uns_url}}/mqtt/gql
enable mentioned account
Request Body
GraphQL Query
mutation accountEnable($input: AccountEnableInput!) {
accountEnable(input: $input) {
account {
username
enabled
}
}
}
Variables
{
"input": {
"acctId": "{{uns_account_id}}"
}
}
Response
Status: 200 OK
{
"data": {
"accountEnable": {
"account": {
"username": "APIclient",
"enabled": true
}
}
}
}
Disable Account
POST {{uns_url}}/mqtt/gql
disable mentioned account
Request Body
GraphQL Query
mutation accountDisable($input: AccountDisableInput!) {
accountDisable(input: $input) {
account {
username
enabled
}
}
}
Variables
{
"input": {
"acctId": "{{uns_account_id}}"
}
}
Response
Status: 200 OK
{
"data": {
"accountDisable": {
"account": {
"username": "APIclient",
"enabled": false
}
}
}
}
Create LitmusEdge Activation Token
POST {{uns_url}}/mqtt/gql
create activation token for LE
Request Body
GraphQL Query
mutation CreateToken($input: CreateTokenRequest!) {
createToken(input: $input) {
token
}
}
Variables
{
"input": {
"accountId": null,
"publicURL": "{{uns_url}}"
}
}
Response
Status: 200 OK
{
"data": {
"createToken": {
"token": "eyJvbmVUaW1lVG9rZW4iOiI3NzZhN2U0NS00MDAyLTQ3ZTMtOWVmZi1hYTNiYTNjNDI4YzkiLCJwdWJsaWNVUkwiOiJodHRwczovLzEwLjE3LjExLjkzL2FwaS92MS9qb2luIn0="
}
}
}
Reset Account Password
POST {{uns_url}}/mqtt/gql
reset account password
This is used because the account password is shown only once, and there is no way to retreive it once copied
Request Body
GraphQL Query
mutation accountUpdate($input: AccountUpdateInput!) {
accountUpdate(input: $input) {
password
account {
username
}
}
}
Variables
{
"input": {
"acctId": "{{uns_account_id}}"
}
}
Response
Status: 200 OK
{
"data": {
"accountUpdate": {
"password": "rdRXu-VwQgZDaZAWb",
"account": {
"username": "APIclient"
}
}
}
}
Add Account Rules
POST {{uns_url}}/mqtt/gql
add rule to an account
Request Body
GraphQL Query
mutation accountAddRules($input: AccountAddRulesInput!) {
accountAddRules(input: $input) {
account {
id
username
rules {
id
path
perm
}
}
}
}
Variables
{
"input": {
"acctId": "{{uns_account_id}}",
"rules": [
{
"path": "{{uns_topic}}",
"perm": "Sub"
}
]
}
}
Response
Status: 200 OK
{
"data": {
"accountAddRules": {
"account": {
"id": "F5A9FA13-1781-4ADD-9C0E-D0463CCCD833",
"username": "APIclient",
"rules": [
{
"id": "8A78DEB0-B7AE-4ED5-A7FB-2429E0977995",
"path": "apiTopic",
"perm": "Deny"
},
{
"id": "0FD2AB85-0B86-4081-B35A-80B266F6D2FF",
"path": "apiTopic",
"perm": "Deny"
}
]
}
}
}
}
Remove Account Rules
POST {{uns_url}}/mqtt/gql
remove rule/s from an account
Request Body
GraphQL Query
mutation accountRemoveRules($input: AccountRemoveRulesInput!) {
accountRemoveRules(input: $input) {
account {
id
username
rules {
id
path
perm
}
}
}
}
Variables
{
"input": {
"acctId": "{{uns_account_id}}",
"ruleIds": [
"320D4C1E-05DB-4E3E-9D40-99DE3F79AB94"
]
}
}
Response
Status: 200 OK
{
"data": {
"accountRemoveRules": {
"account": {
"id": "F5A9FA13-1781-4ADD-9C0E-D0463CCCD833",
"username": "APIclient",
"rules": null
}
}
}
}
Remove Account
POST {{uns_url}}/mqtt/gql
remove an account
Request Body
GraphQL Query
mutation accountDelete($input: AccountDeleteInput!) {
accountDelete(input: $input) {
__typename
}
}
Variables
{
"input": {
"acctId": "{{uns_account_id}}"
}
}
Response
Status: 200 OK
{
"data": {
"accountDelete": {
"__typename": "AccountDeletePayload"
}
}
}