Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Rubick65/calenderyBack/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The followers API lets authenticated users build and manage a social graph. Every follow action creates a directional Follower relation — one user follows another — while every unfollow action removes it. Both listing endpoints are paginated and support real-time name filtering.
The Follower Domain Entity
A Follower record represents a single directed relationship between two users:
| Field | Type | Description |
|---|
followerId | Long | Auto-generated primary key for the relation |
userFollow | User | The user who initiated the follow (the follower) |
userFollowed | User | The user being followed (the followee) |
The relationship is unidirectional: user A following user B does not imply that user B follows user A.
All write endpoints (follow and unfollow) are guarded by a Spring Security
@PreAuthorize("#userId == authentication.principal.idUsuario") expression.
This means the idUsuario query parameter must match the ID of the currently
authenticated user — you cannot follow or unfollow someone on behalf of
another user. Attempting to do so will result in a 403 Forbidden response
before the handler is ever reached.
Endpoints
Follow a User
PUT /api/follower/app/follow
Creates a Follower relation so that idUsuario follows userToFollowId.
Required role: ROLE_USER (ownership-checked — see note above)
Query Parameters
| Parameter | Type | Required | Description |
|---|
idUsuario | Long | ✅ | ID of the authenticated user who wants to follow |
userToFollowId | Long | ✅ | ID of the user to be followed |
Responses
| Status | Description |
|---|
200 OK | Follow relation created successfully. Empty body. |
403 Forbidden | idUsuario does not match the authenticated user’s ID. |
Example
curl -X PUT \
"https://api.example.com/api/follower/app/follow?idUsuario=42&userToFollowId=99" \
-H "Authorization: Bearer <your_jwt_token>"
Unfollow a User
DELETE /api/follower/app/unfollow
Removes the Follower relation between idUsuario and userToUnFollowId.
Required role: ROLE_USER (ownership-checked — see note above)
Query Parameters
| Parameter | Type | Required | Description |
|---|
idUsuario | Long | ✅ | ID of the authenticated user who wants to unfollow |
userToUnFollowId | Long | ✅ | ID of the user to be unfollowed |
Responses
| Status | Description |
|---|
200 OK | Unfollow successful. Empty body. |
403 Forbidden | idUsuario does not match the authenticated user’s ID. |
406 Not Acceptable | UserNotFollowingException — the authenticated user is not currently following the target user. |
Example
curl -X DELETE \
"https://api.example.com/api/follower/app/unfollow?idUsuario=42&userToUnFollowId=99" \
-H "Authorization: Bearer <your_jwt_token>"
Get a User’s Followers
GET /api/follower/app/getUserFollowers
Returns a paginated list of users who follow the specified user, optionally filtered by name.
Required role: ROLE_USER
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|
idUsuario | Long | ✅ | — | ID of the user whose followers to retrieve |
nombre | String | ✅ | — | Name filter (partial match). Pass an empty string to return all followers. |
page | int | ❌ | 0 | Zero-based page index |
size | int | ❌ | 20 | Number of results per page |
sort | String | ❌ | — | Sort field and direction, e.g. nombre,asc |
Response: Page<UserReducedData>
{
"content": [
{
"idUsuario": 7,
"nombre": "alice",
"fotoPerfil": "https://cdn.example.com/avatars/signed-url..."
}
],
"pageable": {
"pageNumber": 0,
"pageSize": 10
},
"totalElements": 1,
"totalPages": 1,
"last": true
}
| Field | Type | Description |
|---|
idUsuario | Long | Unique user identifier |
nombre | String | Username / display name |
fotoPerfil | String | Signed URL for the user’s profile photo |
Example
curl -X GET \
"https://api.example.com/api/follower/app/getUserFollowers?idUsuario=42&nombre=ali&page=0&size=10" \
-H "Authorization: Bearer <your_jwt_token>"
Get a User’s Following
GET /api/follower/app/getUserFollowing
Returns a paginated list of users that the specified user is following, optionally filtered by name.
Required role: ROLE_USER
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|
idUsuario | Long | ✅ | — | ID of the user whose following list to retrieve |
nombre | String | ✅ | — | Name filter (partial match). Pass an empty string to return all. |
page | int | ❌ | 0 | Zero-based page index |
size | int | ❌ | 20 | Number of results per page |
sort | String | ❌ | — | Sort field and direction, e.g. nombre,asc |
Response: Page<UserReducedData>
Same shape as Get a User’s Followers.
{
"content": [
{
"idUsuario": 99,
"nombre": "bob",
"fotoPerfil": "https://cdn.example.com/avatars/signed-url..."
}
],
"pageable": {
"pageNumber": 0,
"pageSize": 10
},
"totalElements": 1,
"totalPages": 1,
"last": true
}
Example
curl -X GET \
"https://api.example.com/api/follower/app/getUserFollowing?idUsuario=42&nombre=&page=0&size=10" \
-H "Authorization: Bearer <your_jwt_token>"