Get Posts
Authentication
Authentication is optional. If authenticated, the response includes upvote status and author flags.
Query Parameters
Filter posts by specific group ID
Filter posts by tab:
"all" (default) - All posts
"trending" - Posts sorted by upvotes
"myGroups" - Posts from groups the user is a member of (requires authentication)
Page number for pagination (default: 1, 15 posts per page)
Response
Indicates whether the request was successful
Array of post objects Unique identifier for the post
Post title (max 200 characters)
Post content (max 5000 characters)
Display name of the author
URL of the author’s profile image
Whether the authenticated user is the author
Group information (if post belongs to a group) Array of tag strings (max 5 tags)
Whether the authenticated user has upvoted this post
Whether the post has been marked as resolved by the author
ISO 8601 timestamp of creation
Whether there are more posts available
Total number of posts matching the query
Code Example
// Get trending posts
const response = await fetch (
'https://api.skillrise.com/api/community/posts?tab=trending&page=1' ,
{
headers: {
'Authorization' : 'Bearer YOUR_TOKEN' // Optional
}
}
);
const data = await response . json ();
console . log ( data . posts );
Response Example
{
"success" : true ,
"posts" : [
{
"_id" : "64a1b2c3d4e5f6789abcdef0" ,
"title" : "How to optimize React renders?" ,
"content" : "I'm working on a large React application and noticing performance issues..." ,
"authorName" : "Jane Doe" ,
"authorImage" : "https://example.com/avatar.jpg" ,
"isAuthor" : false ,
"group" : {
"_id" : "64a1b2c3d4e5f6789abcdef1" ,
"name" : "React Enthusiasts" ,
"slug" : "react-enthusiasts" ,
"icon" : "⚛️"
},
"tags" : [ "react" , "performance" , "optimization" ],
"upvoteCount" : 24 ,
"isUpvoted" : true ,
"replyCount" : 8 ,
"isResolved" : false ,
"createdAt" : "2024-03-15T10:30:00.000Z"
}
],
"hasMore" : true ,
"total" : 156
}
Create Post
Authentication
This endpoint requires user authentication.
Authorization: Bearer < user_toke n >
Request Body
Post title (1-200 characters, will be trimmed)
Post content (1-5000 characters, will be trimmed)
Group ID to post in (optional, null for general posts)
Array of tag strings or comma-separated string (max 5 tags)
Response
Indicates whether the post was created successfully
The newly created post object (same structure as Get Posts response)
Error message if success is false
Code Example
const response = await fetch ( 'https://api.skillrise.com/api/community/posts' , {
method: 'POST' ,
headers: {
'Content-Type' : 'application/json' ,
'Authorization' : 'Bearer YOUR_TOKEN'
},
body: JSON . stringify ({
title: 'Best practices for async/await in JavaScript' ,
content: 'I \' ve been learning about async/await and wanted to share some patterns I \' ve found helpful...' ,
groupId: '64a1b2c3d4e5f6789abcdef1' ,
tags: [ 'javascript' , 'async' , 'best-practices' ]
})
});
const data = await response . json ();
console . log ( data . post );
Get Single Post
Path Parameters
The unique identifier of the post
Response
Includes the full post object with a replies array containing all replies. Accepted answers appear first, followed by other replies sorted by creation date.
Show reply object (within post.replies)
Unique identifier for the reply
Reply content (max 3000 characters)
Display name of the reply author
URL of the author’s profile image
Whether the authenticated user is the author
Whether the authenticated user has upvoted this reply
Whether this reply is marked as the accepted answer
ISO 8601 timestamp of creation
Toggle Post Upvote
Authentication
This endpoint requires user authentication.
Path Parameters
The unique identifier of the post
Response
Indicates whether the operation was successful
New upvote status (true if upvoted, false if removed)
Code Example
const postId = '64a1b2c3d4e5f6789abcdef0' ;
const response = await fetch (
`https://api.skillrise.com/api/community/posts/ ${ postId } /upvote` ,
{
method: 'POST' ,
headers: {
'Authorization' : 'Bearer YOUR_TOKEN'
}
}
);
const data = await response . json ();
console . log ( `Upvotes: ${ data . upvoteCount } ` );
Toggle Post Resolved
Authentication
This endpoint requires user authentication. Only the post author can resolve/unresolve.
Path Parameters
The unique identifier of the post
Response
Indicates whether the operation was successful
Code Example
const postId = '64a1b2c3d4e5f6789abcdef0' ;
const response = await fetch (
`https://api.skillrise.com/api/community/posts/ ${ postId } /resolve` ,
{
method: 'PATCH' ,
headers: {
'Authorization' : 'Bearer YOUR_TOKEN'
}
}
);
const data = await response . json ();
Delete Post
Authentication
This endpoint requires user authentication. Only the post author can delete their post.
Path Parameters
The unique identifier of the post
Response
Indicates whether the post was deleted successfully
Code Example
const postId = '64a1b2c3d4e5f6789abcdef0' ;
const response = await fetch (
`https://api.skillrise.com/api/community/posts/ ${ postId } ` ,
{
method: 'DELETE' ,
headers: {
'Authorization' : 'Bearer YOUR_TOKEN'
}
}
);
const data = await response . json ();
Notes
Posts can belong to a specific group or be general (no group)
Tags can be provided as an array or comma-separated string
The “trending” tab sorts posts by upvote count (descending), then by creation date
The “myGroups” tab filters posts from groups the user has joined
Pagination returns 15 posts per page
Deleting a post also deletes all associated replies
Only post authors can resolve/unresolve or delete their posts
Upvoting is a toggle action - calling it again removes the upvote