Get User
Retrieve user profile information. The backend exposes user read endpoints under api/Authentication (current user, user by ID) and api/UserRead (admin/paged).
Endpoints
Current user (me)
GET /api/Authentication/me
Authentication: Required
User by ID
GET /api/Authentication/user/{userId}
Authentication: Required (subject to privacy)
User media / videos / photos (optional)
GET /api/Authentication/user/{userId}/media
GET /api/Authentication/user/{userId}/videos
GET /api/Authentication/user/{userId}/photos/latest
Path Parameters (user by ID)
| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | GUID | Yes | User ID |
Response
Success (200 OK)
{
"success": true,
"data": {
"id": "user-id",
"username": "johndoe",
"fullName": "John Doe",
"bio": "Software developer",
"profilePicture": "https://...",
"coverPhoto": "https://...",
"location": "San Francisco, CA",
"website": "https://johndoe.com",
"friendsCount": 150,
"postsCount": 45,
"isFriend": false,
"friendRequestStatus": null,
"createdAt": "2024-01-01T00:00:00Z"
}
}
Example
// Get current user
const response = await fetch('http://localhost:5000/api/Authentication/me', {
headers: { 'Authorization': `Bearer ${token}` }
});
// Get specific user
const response = await fetch(`http://localhost:5000/api/Authentication/user/${userId}`, {
headers: { 'Authorization': `Bearer ${token}` }
});
const data = await response.json();
Privacy
User data visibility depends on:
- Privacy settings
- Friend status
- Whether you're viewing your own profile