We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement endpoints to allow users to create and update product comments.
/api/v1/organisations/{orgId}/products/{productId}/comments
/api/v1/organisations/{productId}/comments/{commentId}
To enable users to leave comments on products and update their own comments when needed.
Users should be able to add and update comments on products while ensuring authorization and validation rules are met.
curl -X POST {rootdomain}/api/v1/organisations/{orgId}/products/{productId}/comments \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "comment": "This is a test comment" }'
{ "status_code": 201, "message": "Comment added successfully", "data": { "id": 1, "product_id": 123, "comment": "This is a test comment" } }
{ "status_code": 422, "message": "Validation failed", "errors": { "comment": ["The comment field is required."] } }
curl -X PUT {rootdomain}/api/v1/organisations/{productId}/comments/{commentId} \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "comment": "Updated comment text" }'
{ "status_code": 200, "message": "Comment updated successfully", "data": { "id": 1, "product_id": 123, "comment": "Updated comment text" } }
{ "status_code": 404, "message": "Comment not found." }
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Description
Implement endpoints to allow users to create and update product comments.
Acceptance Criteria
POST
/api/v1/organisations/{orgId}/products/{productId}/comments
PUT
/api/v1/organisations/{productId}/comments/{commentId}
Purpose
To enable users to leave comments on products and update their own comments when needed.
Requirements
Expected Outcome
Users should be able to add and update comments on products while ensuring authorization and validation rules are met.
Tasks
/api/v1/organisations/{orgId}/products/{productId}/comments
to allow commenting./api/v1/organisations/{productId}/comments/{commentId}
to allow updating a comment.Example Requests (With Auth Token)
POST Request (Create Comment)
Response (Success)
Response (Error - Validation Failure)
PUT Request (Update Comment)
Response (Success)
Response (Error - Not Found)
Testing
The text was updated successfully, but these errors were encountered: