The Product Review API allows users to interact with product reviews on the e-commerce platform. It provides functionalities to add new product reviews and retrieve existing reviews for a specific product.
Review listing and adding interface
1. Add Product Review Endpoint
{{baseurl}}/api/v1/reviews/add
Method
POST
Request Body:
order_id: The unique identifier of the order associated with the product. This field can be used to link the review to a specific purchase.
product_id: The unique identifier of the product for which the review is being added.
review: The detailed content of the review, sharing the user's experience with the product.
rating: The numerical rating given by the user (e.g., 1 to 5) to represent their satisfaction with the product.
user_id: (Optional) The unique identifier of the user posting the review. If not provided, the API may automatically infer the user based on the authentication bearer token.
Authorization
The API requires a valid bearer token in the request header for authentication. Users must include their bearer token in the "Authorization" header of the HTTP request to add a product review successfully.
Response Format
The API responds with a JSON object indicating the success of the review submission.
2. Get Product Reviews Endpoint
{{baseurl}}/api/v1/product/reviews
Method
POST
Request Body
.product_id: The unique identifier of the product for which reviews are requested.
Authorization
The API requires a valid bearer token in the request header for authentication. Users must include their bearer token in the "Authorization" header of the HTTP request to add a product review successfully.
Response Format
The API responds with a JSON object containing a list of product reviews for the specified page.
Features:
The API allows users to submit reviews for a specific product and retrieve existing reviews for a product in a paginated manner.
Users can provide a rating and detailed feedback, helping other potential buyers make informed decisions.
Usage:
The Add Product Review API is used when a user wants to share their experience with a product by providing a review and rating. The Get Product Reviews API is used to display product reviews to users, promoting transparency and trust in the products offered.
{
"success": true,
"data": {
"id": 16,
"order_id": "57",
"user_id": 80,
"product_id": "1",
"product_country_id": 90,
"country_id": 10,
"rating": "4",
"review": "ok it is very good product with best quality i like the product so much the amount is 1200 i got for 500",
"status": 1,
"created_at": "2023-07-24T05:47:56.000000Z",
"updated_at": "2023-08-05T20:15:38.000000Z"
},
"message": "Success",
"status_code": 200
}
{
"success": true,
"data": {
"reviews": [
{
"id": 17,
"user_name": "Shiju",
"avatar": "https://dev.majarat.ae/assets/img/avatar-place.png",
"rating": 3,
"review": "ok",
"created_at": "31-07-2023",
"updated_at": "04-08-2023"
},
{
"id": 16,
"user_name": "Shiju",
"avatar": "https://dev.majarat.ae/assets/img/avatar-place.png",
"rating": 4,
"review": "ok it is very good product with best quality i like the product so much the amount is 1200 i got for 500",
"created_at": "24-07-2023",
"updated_at": "06-08-2023"
},
{
"id": 14,
"user_name": "i1344",
"avatar": "https://dev.majarat.ae/assets/img/avatar-place.png",
"rating": 5,
"review": "ok it is very good product with best quality i like the product so much the amount is 1200 i got for 500",
"created_at": "18-07-2023",
"updated_at": "18-07-2023"
}
],
"current_user_review": [
{
"id": 14,
"user_id": 17,
"avatar": "https://dev.majarat.ae/assets/img/avatar-place.png",
"order_id": 1,
"user_name": "i1344",
"rating": 5,
"review": "ok it is very good product with best quality i like the product so much the amount is 1200 i got for 500",
"created_at": "18-07-2023",
"updated_at": "18-07-2023"
}
],
"avg_rating": 4,
"total_ratings": 3
},
"message": "Success",
"status_code": 200
}