Get Post
Retrieve a single post, feed, or user posts. The backend uses api/Post.
Endpoints
Get single post
GET /api/Post/{postId}
Authentication: Optional (required for private posts)
Get personalized feed
GET /api/Post/feed/home?userId={userId}&limit=20&offset=0&includeScoreDetails=false
Authentication: Required
| Parameter | Type | Default | Description |
|---|---|---|---|
| userId | GUID | required | Current user ID |
| limit | int | 20 | Max posts to return |
| offset | int | 0 | Pagination offset |
| includeScoreDetails | bool | false | Include recommendation score breakdown |
Get user's posts
GET /api/Post/users/{userId}/posts?page=1&limit=20
Authentication: Required (subject to visibility)
Path Parameters (single post)
| Parameter | Type | Required | Description |
|---|---|---|---|
| postId | GUID | Yes | Post ID |
Response (single post)
Success (200 OK)
{
"success": true,
"data": {
"id": "post-guid",
"caption": "Post content here",
"author": {
"id": "user-id",
"fullName": "John Doe",
"username": "johndoe",
"profilePicture": "url"
},
"visibility": "Public",
"media": [],
"reactions": { "like": 10, "love": 5, "total": 15 },
"commentsCount": 3,
"createdAt": "2024-01-01T00:00:00Z",
"userReaction": "like"
}
}
Example
// Single post
const response = await fetch(`http://localhost:5000/api/Post/${postId}`, {
headers: { 'Authorization': `Bearer ${token}` }
});
// Feed
const response = await fetch(
`http://localhost:5000/api/Post/feed/home?userId=${userId}&limit=20&offset=0`,
{ headers: { 'Authorization': `Bearer ${token}` } }
);