Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Profiles can be managed using Websocket API or REST API.

Profile creation

A new profile can be created with REST API query /api/profile/create

...

request

APIRequestResponseResponse status
WS API
Code Block
themeRDark

...

SEND
destination:/app/api/profile/create
content-length:159

{
 "requestId":"26f4895a-2001-46e0-af56-2a130544f1b7",
 "realm":"/api/profile/create",
 "payload":
 {

...

  "name":

...

"profile1",

...

  "rate":"30",
  "metrics":["3","10"],
  "rules":["1"]
 }
}
Code Block
themeRDark
MESSAGE
destination:/user/service
content-type:application/json;charset=UTF-8
subscription:sub-1
message-id:3-10
content-length:84

{
 "requestId":"

...

26f4895a-2001-46e0-af56-2a130544f1b7",
 "status":200,
 "reason":"SUCCESS"
}

200 OK

400 Object not found

500 Persist exception

REST API
Code Block
themeRDark
POST: /api/profile/create "application/json; charset=utf-8"
{
 "name":"profile2",
 "rate":"30",
 "metrics":

...

["

...

1",

...

"

...

2"],

...

 "rules":

...

["

...

1"]
}
Code Block
themeRDark
{
 "status":200,
 "reason":"SUCCESS"
}

200 OK

400 Object not found

500 Persist exception

Where

  • name – profile name
  • rate – metric acquisition rate
  • metrics – metric identifiers list
  • rules – rule identifiers list

...

A profile can be changed with REST API query /api/profile/update

...

request

APIRequestResponseResponse status
WS API
Code Block
themeRDark

...

SEND
destination:/

...

app/api/profile/update
content-length:166

{
 "requestId":"76d35097-7948-4e58-a7ae-f4d11ed63e02",
 "realm":"/api/profile/update",
 "payload":
 {

...

  "id":

...

"

...

2",
  "name":"static",
  "rate"

...

:"30",
  "

...

metrics":["3","10"],
  "rules":["1"]
 }
}
Code Block
themeRDark
MESSAGE
destination:/user/service
content-type:application/json;charset=UTF-8
subscription:sub-1
message-id:3-11
content-length:84

{
 "requestId":"76d35097-7948-4e58-a7ae-f4d11ed63e02",
 "status":200,
 "reason":"SUCCESS"
}

200 OK

400 Object not found

500 Persist exception

REST API
Code Block
themeRDark
POST: /api/profile/update "application/json; charset=utf-8"
{
 "id":"3",
 "name":"profile1",
 "rate":"30",
 "metrics":

...

["

...

3",

...

"

...

10"],

...

 "rules":

...

["

...

1"]
}
Code Block
themeRDark
{
 "status":200,
 "reason":"SUCCESS"
}

200 OK

400 Object not found

500 Persist exception

Where

  • id – profile identifier
  • name – profile name
  • rate – metric acquisition rate
  • metrics – metric identifiers list
  • rules – rule identifiers list

...

A profile can be deleted with REST API query  /api/profile/delete request

APIRequestResponseResponse status
WS API
Code Block

...

themeRDark
SEND
destination:/app/api/profile/delete
content-length:103

{
 "requestId":"e2412d55-4256-4004-bb93-620af1905deb",
 "realm":"/api/profile/delete",
 "payload":
 {
  "id":"3"
 }
}
Code Block
themeRDark

...

MESSAGE
destination:/user/

...

service
content-type:application/json;charset=UTF-8
subscription:sub-1
message-id:3-14
content-length:84

{
 "requestId":"e2412d55-4256-4004-bb93-620af1905deb",
 "status":200,
 "reason":"SUCCESS"
}

200 OK

400 Object not found

500 Persist exception

REST API
Code Block
themeRDark
POST: /api/profile/delete "application/json; charset=utf-8"
{

...

 "id":"4"
}
Code Block
themeRDark
{
 "status":200,
 "

...

reason":"SUCCESS"
}

200 OK

400 Object not found

500 Persist exception

Where

  • id – profile identifier

...

A profile information can be obtained with REST API query  /api/profile/list request

...

APIRequestResponseResponse status
WS API
Code Block
themeRDark
SEND
destination:/app/api/profile/list
content-length:101

{
 "requestId":"2e29bebf-9773-429e-84b6-287dc4d3d479",
 "realm":"/api/profile/list",
 "payload":
 {
  "id":"2"
 }
}
Code Block
themeRDark

...

MESSAGE
destination:/

...

user/service
content-type:application/json;charset=UTF-8
subscription:sub-1
message-id:3-16
content-length:160

{
 "requestId":"2e29bebf-9773-429e-84b6-287dc4d3d479",
 "status":200,
 "reason":"SUCCESS",
 "payload":[
  {
   "id":2,
   "name":"static",
   "rate":30,
   "metrics":[3,10],
   "rules":[1]
  }
 ]
}

200 OK

400 Object not found

500 Persist exception

REST API
Code Block
themeRDark
POST: /api/profile/list "application/json; charset=utf-8"
{
 "id":"2"
}
Code Block
themeRDark
{
    "status": 200,
    "reason": "SUCCESS",

...

    "payload": [
        {
            "id": 2,
            "name": "static",
            "rate": 30,
            "metrics": [
                3,
                10
            ],
            "rules": [
                1
            ]
        }
    ]
}

200 OK

400 Object not found

500 Persist exception

Where

  • id – profile identifier

...

For every profile, the response contains the same fields as /api/profile/update queryrequest.