Overview
The Reviews API allows authenticated users to submit feedback and reviews for the platform. Admin users can retrieve all reviews for analysis and moderation.
Submit Review
curl -X POST "https://your-domain.com/api/reviews" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"rating": 5,
"comment": "Great platform for organizing my study resources!"
}'
POST /api/reviews
Submit a new review for the platform. Requires authentication.
Request Body
Review comment or feedback
Response
ID of the user who submitted the review
Timestamp when the review was created
Success Response
Error Response
{
"_id" : "507f1f77bcf86cd799439011" ,
"userId" : "507f191e810c19729de860ea" ,
"rating" : 5 ,
"comment" : "Great platform for organizing my study resources!" ,
"createdAt" : "2024-03-15T10:30:00.000Z"
}
Common Errors
400 Bad Request - Invalid rating (must be 1-5) or missing comment
401 Unauthorized - Missing or invalid authentication token
500 Internal Server Error - Server error while saving review
Get All Reviews (Admin Only)
curl -X GET "https://your-domain.com/api/reviews" \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN"
GET /api/reviews
Retrieve all submitted reviews with user information. Requires admin authentication.
This endpoint is restricted to admin users only. Regular users will receive a 403 Forbidden error.
Response
Returns an array of review objects enriched with user information.
Array of review objects ID of the user who submitted the review
Timestamp when the review was created
User information User’s profile photo URL (optional)
Success Response
Error Response (Forbidden)
[
{
"_id" : "507f1f77bcf86cd799439011" ,
"userId" : "507f191e810c19729de860ea" ,
"rating" : 5 ,
"comment" : "Great platform for organizing my study resources!" ,
"createdAt" : "2024-03-15T10:30:00.000Z" ,
"user" : {
"_id" : "507f191e810c19729de860ea" ,
"displayName" : "John Doe" ,
"email" : "[email protected] " ,
"photoURL" : "https://example.com/photo.jpg"
}
},
{
"_id" : "507f1f77bcf86cd799439012" ,
"userId" : "507f191e810c19729de860eb" ,
"rating" : 4 ,
"comment" : "Very helpful for tracking progress across multiple courses." ,
"createdAt" : "2024-03-14T15:20:00.000Z" ,
"user" : {
"_id" : "507f191e810c19729de860eb" ,
"displayName" : "Jane Smith" ,
"email" : "[email protected] "
}
}
]
Common Errors
401 Unauthorized - Missing or invalid authentication token
403 Forbidden - User does not have admin role
500 Internal Server Error - Server error while fetching reviews
Notes
Reviews are sorted by newest first (descending createdAt)
User information is included only for admin requests to protect privacy
Each user can submit multiple reviews
Reviews are stored permanently and cannot be deleted by users (admin-only moderation)