Skip to main content

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

ParameterTypeDefaultDescription
userIdGUIDrequiredCurrent user ID
limitint20Max posts to return
offsetint0Pagination offset
includeScoreDetailsboolfalseInclude recommendation score breakdown

Get user's posts​

GET /api/Post/users/{userId}/posts?page=1&limit=20

Authentication: Required (subject to visibility)

Get saved (bookmarked) posts​

GET /api/Post/saved?page=1&pageSize=10

Authentication: Required — see Save / Unsave Post

Path Parameters (single post)​

ParameterTypeRequiredDescription
postIdGUIDYesPost 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",
"isSaved": false
}
}

When the caller is authenticated, isSaved indicates whether the current user has bookmarked the post. Feed, profile, and hashtag post lists include the same flag.

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}` } }
);

Next Steps​