4. User Group Permission Management
What This Chapter Does
It manages user groups and permissions through the API. Not only querying but also creating, changing, and deleting.
When to use it -- when integrating with an in-house HR system or account management tool to reflect joiners, leavers, and department moves in APM accounts automatically. With only a few users, managing them directly on the console screen is simpler.
Creating, changing, and deleting take effect immediately and no history is kept. When building an integration program, check it in a test environment first.
User Group Management
Query
Fetches the list of registered user groups. The group name is used to point at the target in the permission management APIs below.
| Item | Description |
|---|---|
| URL | /monitoring/api/userGroups |
| Example request URL | /monitoring/api/userGroups |
| HTTP METHOD | GET |
| Content-Type | application/json; charset=UTF-8 |
| Body | |
| Response | The response content is below |
| * type · APP - Built-in Group Name · APP_USER - User Defined Group Name · WEB – Web Server Ip Address · SYS – System IP Address · SVC_CHK - Service Health Check |
Response content
{
"status": 200,
"result": [
{
"groupId": "admin",
"description": "Administrator group",
"delete": false,
"registered": 1502182126875,
"updated": 1534510452364,
"metricPatterns": null,
"metricPatternsList": []
},
{
"groupId": "users",
"description": "User group",
"delete": false,
"registered": 1502182126871,
"updated": 1534510452375,
"metricPatterns": [ <-- permission information
{
"uuid": "26A1578B-F5EE-4475-8946-03994D37BB46",
"type": "APP", <-- Build-in Group Name
"name": "All Group",
"pattern": ".*"
},
{
"uuid": "A967B8D9-AD1D-4E49-91E9-BF3AAD49EA31",
"type": "WEB", <-- Web Server IP Address
"name": "WebServer All",
"pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"
},
{
"uuid": "CEC2FC94-FBE8-4A84-8920-972D4E3B693C",
"type": "SYS", <-- System IP Address
"name": "System All",
"pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"
}
],
}
]
}
Create
Creates a new user group. A group on its own has no permissions, so follow it with group permission management to specify what it can see.
| Item | Description |
|---|---|
| URL | /monitoring/api/userGroup |
| Example request URL | /monitoring/api/userGroup |
| HTTP METHOD | POST |
| Content-Type | application/json; charset=UTF-8 |
| Body | [{"groupId": "testGroups", "description": "Test group"}] |
| Response | { "status": 200 } |
Update
Changes the group name and description. The member users and permissions stay as they are.
| Item | Description |
|---|---|
| URL | /monitoring/api/userGroup |
| Example request URL | /monitoring/api/userGroup |
| HTTP METHOD | PUT |
| Content-Type | application/json; charset=UTF-8 |
| Body | {"groupId": "testGroups", "description": " Test group 33"} |
| Response | { "status": 200 } |
Delete
Deletes the group. Users who belonged only to that group can then see nothing -- move the users to another group before deleting it.
| Item | Description |
|---|---|
| URL | /monitoring/api/userGroup/{group id} |
| Example request URL | /monitoring/api/userGroup/testGroups |
| HTTP METHOD | DELETE |
| Content-Type | application/json; charset=UTF-8 |
| Body | |
| Response | { "status": 200 } |
Group Permission Management
Create
Adds to what the group can see. Application groups, web servers, and systems are distinguished by
kind (type).
| Item | Description |
|---|---|
| URL | /monitoring/api/userGroup/metricPattern/{group id} |
| Example request URL | /monitoring/api/userGroup/metricPattern/testGroups |
| HTTP METHOD | POST |
| Content-Type | application/json; charset=UTF-8 |
| Body | {type: "APP", name: "eap64 app", pattern: "^eap64.*"} |
| * type · APP - Built-in Group Name · APP_USER - User Defined Group Name · WEB – Web Server Ip Address · SYS – System IP Address · SVC_CHK - Service Health Check | |
| Response | { "status": 200 } |
Update
Replaces the whole target list of an already granted permission. It is an overwrite, not an addition, so the targets you want to keep have to be sent as well.
| Item | Description |
|---|---|
| URL | /monitoring/api/userGroup/metricPattern/{group id} |
| Example request URL | /monitoring/api/userGroup/metricPattern/testGroups |
| HTTP METHOD | PUT |
| Content-Type | application/json; charset=UTF-8 |
| Body | {type: "APP", name: "eap64 app 11", pattern: "^eap64-11.*"} |
| * type · APP - Built-in Group Name · APP_USER - User Defined Group Name · WEB – Web Server Ip Address · SYS – System IP Address · SVC_CHK - Service Health Check | |
| Response | { "status": 200 } |
Delete
Withdraws the permission. The group itself stays.
| Item | Description |
|---|---|
| URL | /monitoring/api/userGroup/metricPattern/{group id} |
| Example request URL | /monitoring/api/userGroup/metricPattern/testGroups |
| HTTP METHOD | DELETE |
| Content-Type | application/json; charset=UTF-8 |
| Body | ["6EFA1F39-6675-4F24-9C22-D19CDEC055AD"] |
| Response | { "status": 200 } |