Conversation
SweetCodey
left a comment
There was a problem hiding this comment.
Reviewed until API Design and left feedback
| * **Track order status:** Users should be able to view order status and track shipment progress. | ||
| * **View recommendations:** Users should receive personalized recommendations based on browsing and order history. | ||
|
|
||
| ### Non-Functional Requirements |
There was a problem hiding this comment.
Can we also mention the numbers here for availability and scalability?
|
|
||
| ```json | ||
| { | ||
| "recommendations": [ |
There was a problem hiding this comment.
Love the reason parameter. Very thoughtful!
|
|
||
| This API allows users to search for products using keywords and apply filters and sorting. | ||
|
|
||
|  |
There was a problem hiding this comment.
Do we want to send available quantity back to the client?
There was a problem hiding this comment.
Yes. This will be helpful if we want to show messages on search result like Only few quantities left or Only 10 quantities left
| "reviewCount": 2547, | ||
| "imageUrl": "https://cdn.shopping.com/images/prod_12345.jpg", | ||
| "inStock": true, | ||
| "availableQuantity": 145 |
There was a problem hiding this comment.
Do we want to send available quantity back to the client?
There was a problem hiding this comment.
Yes. This will be helpful if we want to show messages on search result like Only few quantities left or Only 10 quantities left
| The server returns a list of products matching the search criteria along with pagination metadata. | ||
|
|
||
| ```json | ||
| { |
There was a problem hiding this comment.
Thank you for including filters and pagination there.
|
|
||
| **HTTP Method & Endpoint** | ||
|
|
||
| We use `POST` method because adding an item to the cart creates a new entry in our system. The endpoint would be `/v1/cart/{cartId}/items`. |
There was a problem hiding this comment.
Would be great if you can add one more line explaining why you went for v1/cart/{cartid}/items instead of v1/cart/{cartid}. Tell that you are making changes to the items in the cart and not the cart itself.
| **HTTP Method & Endpoint** | ||
|
|
||
| We use `PATCH` method for this API because it updates only a specific field (quantity) of an existing | ||
| item without replacing the entire item. The endpoint would be `/v1/cart/{cartId}/items/{itemId}` |
There was a problem hiding this comment.
Something to think about: Why did we go for endpoint as v1/cart/cartid/items/itemid and not v1/cart/cartid/items? We can always pass in item ID in the body.
There was a problem hiding this comment.
I preferred itemid because:
- As per REST principle, URL should identify the resource. Since item is treated as a separate resource, we mentioned itemid in url
- It also makes the traceability of access logs easier.
Please let me know if u think otherwise
|
|
||
| #### Remove from Cart | ||
|
|
||
| This API allows users to remove an item from the cart. |
There was a problem hiding this comment.
This feels like updating the cart and not deleting. Can we remove the deletion and only have the update the cart API design?
Same for HLD for delete item. We can simply say that is updating cart.
|
|
||
| This API allows users to place an order with items from their cart. | ||
|
|
||
|  |
There was a problem hiding this comment.
The image seems to be wrong. Can you verify it once?
There was a problem hiding this comment.
Sure. will update
No description provided.