Likes and comments apis
Here are the extracted API endpoints and their corresponding payloads:
1. BuddyPress Activity Likes (POST & DELETE)
- Endpoint:
/buddypress/v1/activity/(?P<activity_id>\d+)/likes
- Methods:
- POST: Like an activity
- DELETE: Unlike an activity
Payload:
- No request payload. Just the
activity_id
in the URL. - Response: Success message or error message.
2. Get Activity by ID
- Endpoint:
/buddypress/v1/activity/id/(?P<id>\d+)
- Methods:
- GET: Retrieve activity details by ID.
Payload:
- No request payload. Just the
id
in the URL. - Response: Activity data.
3. Custom Like Post
- Endpoint:
/custom/v1/like
- Methods:
- POST: Like a post
Payload:
{
"post_id": "integer" // The ID of the post
}
- Response: Success or error message.
4. Custom Unlike Post
- Endpoint:
/custom/v1/unlike
- Methods:
- POST: Unlike a post
Payload:
{
"post_id": "integer" // The ID of the post
}
- Response: Success or error message.
5. Get Total Likes and Users for a Post
- Endpoint:
/custom/v1/get-likes
- Methods:
- GET: Get the total number of users who liked a post.
Payload:
{
"post_id": "integer" // The ID of the post
}
- Response:
{
"total_likes": "integer",
"user_ids": ["array of user IDs"]
}
6. Make a Comment on a Post
- Endpoint:
/custom/v1/comment
- Methods:
- POST: Make a comment on a post
Payload:
{
"post_id": "integer", // The ID of the post
"content": "string" // The comment content
}
- Response: Comment data (ID, post ID, content, author ID).
7. Reply to a Comment
- Endpoint:
/custom/v1/comment/reply
- Methods:
- POST: Reply to an existing comment
Payload:
{
"comment_id": "integer", // The ID of the comment
"content": "string" // The reply content
}
- Response: Reply data (ID, comment ID, content, author ID).
8. Delete a Comment
- Endpoint:
/custom/v1/comment/delete
- Methods:
- POST: Delete a comment
Payload:
{
"comment_id": "integer" // The ID of the comment
}
- Response: Success or error message.
9. Get Comments with Associated User Data
- Endpoint:
/custom/v1/get-comments-with-user
- Methods:
- GET: Retrieve all comments with associated user data for a post.
Payload:
{
"post_id": "integer" // The ID of the post
}
- Response:
{
"total_comments": "integer",
"user_ids": ["array of user IDs"],
"comments": [
{
"comment_id": "integer",
"comment_content": "string",
"comment_author": "string",
"comment_date": "string",
"user_id": "integer",
"user_details": {
"user_id": "integer",
"user_name": "string",
"user_email": "string",
"user_avatar": "string"
}
}
]
}
These are the key API endpoints and their expected payloads in your provided code.
Comments
Post a Comment