Description
Retrieve a single user by their unique identifier. Returns a user object with HATEOAS links.
The password field is never included in response objects for security purposes.
Request
The unique identifier of the user to retrieve
Response
Returns an EntityModel wrapping a UserView object with HATEOAS links.
Unique identifier for the user
Email address of the user
User role in the system. Possible values: CUSTOMER, ADMIN
Timestamp when the user was created (ISO 8601 format)
HATEOAS links for the user resourceLink to this specific user
Status Codes
Successfully retrieved the user
User with the specified ID does not exist (throws UserNotFoundException)
Security
Password fields are encrypted using PasswordEncoder and are never returned in API responses.
Example Request
curl -X GET http://localhost:8080/users/1 \
-H "Content-Type: application/json"
Example Response
Success (200 OK)
{
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"role": "CUSTOMER",
"createdAt": "2026-03-01T10:30:00",
"_links": {
"self": {
"href": "http://localhost:8080/users/1"
}
}
}
Error (404 Not Found)
{
"error": "User not found",
"message": "Could not find user with id: 999"
}