29.2.3. Users
The Security Management REST API supports the following endpoints for managing users in Business Central. The Security Management REST API base URL is http://SERVER:PORT/decision-central/rest/. All requests require HTTP Basic authentication or token-based authentication for the admin user role.
- [GET] /users
Returns all users in Business Central.
Example server response (JSON)
[ "newUser", "user1", "user2", ]- [GET] /users/{userName}/groups
Returns all groups assigned to a specified user.
Expand 表29.3 Request parameters Name Description Type Requirement userNameName of the user for whom you are retrieving assigned groups
String
Required
Example server response (JSON)
[ { "group1" }, { "group2" } ]- [GET] /users/{userName}/roles
Returns all roles assigned to a specified user.
Expand 表29.4 Request parameters Name Description Type Requirement userNameName of the user for whom you are retrieving assigned roles
String
Required
Example server response (JSON)
[ { "name": "process-admin" }, { "name": "manager" }, { "name": "admin" } ]- [POST] /users
Creates a specified user with specified roles and groups.
Example request body (JSON)
{ "name": "newUser", "roles": [ "admin", "developer" ], "groups": [ "group1", "group2" ] }Example server response (JSON)
{ "status": "OK", "message": "User newUser is created successfully." }- [Post] /users/{userName}/changePassword
Changes the password of a specified user.
Expand 表29.5 Request parameters Name Description Type Requirement userNameName of the user for whom you are changing the password
String
Required
Example request command
curl -u 'baAdmin:password@1' -H "Accept: application/json" -H "Content-Type: application/json" -X POST "http://localhost:8080/decision-central/rest/users/newUser/changePassword" -d newpasswordExample server response (JSON)
{ "status": "OK", "message": "Password for newUser has been updated successfully." }- [DELETE] /users/{userName}
Deletes a specified user from Business Central.
Expand 表29.6 Request parameters Name Description Type Requirement userNameName of the user to be deleted
String
Required
Example server response (JSON)
{ "status": "OK", "message": "User newUser is deleted successfully." }- [POST] /users/{userName}/groups
Overrides the existing groups assigned to a specified user with new groups.
Expand 表29.7 Request parameters Name Description Type Requirement userNameName of the user for whom you are updating groups
String
Required
Example request body (JSON)
[ "newGroup" ]Example server response (JSON)
{ "status": "OK", "message": "Groups [newGroup] are assigned successfully to user wbadmin" }- [POST] /users/{userName}/roles
Overrides the existing roles assigned to a specified user with new roles.
Expand 表29.8 Request parameters Name Description Type Requirement userNameName of the user for whom you are updating roles
String
Required
Example request body (JSON)
[ "admin" ]Example server response (JSON)
{ "status": "OK", "message": "Roles [admin] are assigned successfully to user wbadmin" }