GET /api/roles/search
Performs a paginated search of roles with optional filtering by name. This endpoint is useful for displaying roles in a table or list with pagination controls.Authentication
This endpoint requires authentication. Include a valid JWT token in the Authorization header.Query Parameters
Optional filter to search for roles by name. Performs a partial match.
- Example:
"admin"will match “Administrator”, “Admin”, “System Admin”
The page number to retrieve (zero-based index).
- Minimum: 0
- Example:
0for the first page,1for the second page
The number of results per page.
- Default: 10
- Example:
20to retrieve 20 roles per page
Response
Current page number (zero-based)
Number of items per page
Total number of roles matching the search criteria
Total number of pages available
Indicates whether this is the last page
Error Responses
- 400 Bad Request: Invalid parameters (e.g., negative page number, invalid size)
- 500 Internal Server Error: Unexpected server error
Example Request
Example Response
Example Error Response
Usage Notes
- Use the
nameparameter for type-ahead search functionality - The search is case-insensitive and performs partial matching
- Calculate the next page by incrementing
pageNumberuntilisLastistrue - Use
totalElementsandtotalPagesfor pagination UI components