Overview
The Roles API provides endpoints to create, manage, and assign roles to users. Roles are used to group permissions and control access to different parts of the application.Authentication
All Roles endpoints require the Administrator role. You must include a valid JWT token in the Authorization header:Base URL
Available Endpoints
Role Management
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/Roles | Get all roles |
| GET | /api/Roles/{roleId} | Get a specific role by ID |
| POST | /api/Roles | Create a new role |
| PUT | /api/Roles/{roleId} | Update an existing role |
| DELETE | /api/Roles/{roleId} | Delete a role |
Role Assignment
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/Roles/user/{userId} | Get all roles assigned to a user |
| POST | /api/Roles/assign | Assign a role to a user |
| POST | /api/Roles/remove | Remove a role from a user |
Role Entity Structure
Roles in the system have the following structure:Unique identifier for the role
Name of the role (e.g., “Administrator”, “User”, “Manager”)
Normalized version of the role name (uppercase)
Number of permissions assigned to this role
Predefined Roles
The system includes the following predefined roles:- Administrator - Full system access
- User - Standard user access
- Manager - Management-level access
Example Response
Error Responses
All endpoints may return the following error responses:- 400 Bad Request - Invalid request parameters
- 401 Unauthorized - Missing or invalid authentication token
- 403 Forbidden - User does not have Administrator role
- 404 Not Found - Role not found
- 500 Internal Server Error - Server error
Next Steps
Create Role
Learn how to create new roles
Assign Role
Assign roles to users