Actions
Bug #83
closedCategory Validation Failure with Multiple IDs in Product API (Web-API)
Status:
Closed
Priority:
High
Assignee:
-
Description
The product creation API incorrectly validates the category field when multiple category IDs are provided as a comma-separated string in a multipart/form-data request.
Although each individual value appears to be a valid MongoDB ObjectId, the backend rejects the request with the error:{"success":false,"message":"Category must be a valid ID"}
Endpoint:
https://api.akinderwellness.com:4001/api/products/add
Steps to Reproduce
- Craft a request to the product creation endpoint (multipart/form-data).
- Provide multiple category IDs in the category field as a comma-separated string:
- category = 69c10cfb7a5370455e2f83bc,69c10cbd7a5370455e2f83ae,69901934d6ca9152e44df413
- Send the request.
Observed Result
The API responds with:{"success":false,"message":"Category must be a valid ID"}
Even though all provided values are valid MongoDB ObjectIds.
Expected Result
The API should correctly handle multiple category IDs.
Updated by Adhi Narayanan 6 days ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Actions