Endpoint
GET /api/users/{username}/following
Authentication
This endpoint requires authentication.
Path Parameters
The username of the user whose following list you want to retrieve
Response
The total number of users being followed
Array of user objects that are being followedShow Following User Object
The unique identifier of the followed user
The username of the followed user
The first name of the followed user
The last name of the followed user
The URL of the followed user’s profile image. Returns a default image URL if not set.
Request Example
curl -X GET "https://api.example.com/api/users/johndoe/following" \
-H "Authorization: Bearer YOUR_TOKEN"
Response Example
{
"followingCount": 3,
"Followers": [
{
"UserId": 789,
"userName": "alice_wonder",
"firstName": "Alice",
"lastName": "Wonder",
"profileImage_MediaUrl": "https://example.com/images/alice.png"
},
{
"UserId": 321,
"userName": "charlie_brown",
"firstName": "Charlie",
"lastName": "Brown",
"profileImage_MediaUrl": "https://defaults.com/default.png"
},
{
"UserId": 654,
"userName": "eve_tech",
"firstName": "Eve",
"lastName": "Tech",
"profileImage_MediaUrl": "https://example.com/images/eve.png"
}
]
}
Error Responses
Not Found - The specified user account does not exist
Implementation Details
This endpoint uses an optimized projection query similar to the followers endpoint:
- The query first retrieves the following account IDs (follow.list.cs:43-47)
- A second query fetches the full user details for those IDs (follow.list.cs:49-50)
AsNoTracking() is used for read-only queries to improve performance (follow.list.cs:47)
- Username comparison is case-insensitive (follow.list.cs:43)