Back to API List
Comments & Reviews API
Handle user comments, reviews, ratings, moderation, and threaded discussions.
Social
Internal API - Hosted by this App
API Endpoints & Usage
Explore and interact with the available endpoints for the Comments & Reviews API. These API routes are live! The paths shown below are relative to your application's base URL. For example, if this application is hosted at
https://gen-endpoint.com
, an endpoint path for this API, such as /api/comments
, would be accessible at https://gen-endpoint.com/api/comments
. You can use the "Try it out" section for each endpoint or use tools like curl
, Postman, or your browser's address bar (for GET requests) to interact with them.POST
/api/comments
Create new comment or review with rating.
Show Static Examples
Example Request Body:
{
"resourceType": "post",
"resourceId": "post_123",
"content": "Great article! Very helpful.",
"rating": 5,
"parentId": null
}
Example Response:
{
"id": "comment_456",
"content": "Great article! Very helpful.",
"author": {
"id": "usr_2",
"name": "Bob Builder"
},
"rating": 5,
"status": "pending_moderation",
"createdAt": "2024-08-16T12:00:00Z"
}
Try it out
GET
/api/comments/{resourceId}
Get comments for resource with threading and pagination. Replace {resourceId} with an actual ID.
Show Static Examples
Example Request Parameters:
?resourceType=post&sort=newest&page=1&limit=20
Example Response:
{
"comments": [
{
"id": "comment_456",
"content": "Great article!",
"author": {
"name": "Bob Builder",
"avatar": "https://placehold.co/40x40.png"
},
"rating": 5,
"replies": [],
"createdAt": "2024-08-16T12:00:00Z"
}
],
"summary": {
"total": 45,
"averageRating": 4.2
}
}
Try it out
Replace placeholders (e.g., {userId}) with actual values in the path above. You can also add/edit query parameters (e.g., ?key=value).
PUT
/api/comments/{commentId}/moderate
Moderate comment - approve, reject, or flag. Replace {commentId} with an actual ID.
Show Static Examples
Example Request Body:
{
"action": "approve",
"moderatorNote": "Content appropriate"
}
Example Response:
{
"id": "comment_456",
"status": "approved",
"moderatedAt": "2024-08-16T12:05:00Z",
"moderatedBy": "usr_1"
}
Try it out
Replace placeholders (e.g., {userId}) with actual values in the path above.