Wishlist
Save products, check membership and move items to the cart.
Authentication
All Wishlist endpoints require Bearer token authentication. Include the access token in the Authorization header:
Wishlist Endpoints
| Method | Endpoint | Description | Authentication Required |
|---|---|---|---|
| POST | /api/v1/wishlists |
Add a product to wishlist | Yes |
| GET | /api/v1/wishlists |
Retrieve user's wishlist items (Paginated) | Yes |
| GET | /api/v1/wishlists/check |
Check if a product is in wishlist | Yes |
| POST | /api/v1/wishlists/move-to-cart |
Move a wishlist product into the cart | Yes |
| DELETE | /api/v1/wishlists/remove |
Remove a product from wishlist | Yes |
| GET | /api/v1/wishlists/ids |
List wishlisted product IDs | Yes |
Endpoint Details
1. Add Product to Wishlist
POST
/api/v1/wishlists
| Parameter | Type | Required | Description |
|---|---|---|---|
productId |
string | Yes | UUID of the product to add to wishlist |
Headers
| Header | Value | Required |
|---|---|---|
Authorization |
Bearer <access_token> |
Yes |
Content-Type |
application/json |
Yes |
Request
curl -X 'POST' \
'http://localhost:8080/api/v1/wishlists' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9...' \
-H 'Content-Type: application/json' \
-d '{
"productId": "5b24d429-c981-47c8-9318-f4d61dd2c1a4"
}'
Response
{
"product": {
"id": "5b24d429-c981-47c8-9318-f4d61dd2c1a4",
"categoryId": "58f5c085-d04a-47de-beab-1d476b6ce432",
"name": "Polo T Shirt",
// ... product details
}
}
}
2. Get Wishlist Items
GET
/api/v1/wishlists
| Parameter | Type | Required | Description |
|---|---|---|---|
limit |
number | No | Maximum number of items to return (default: 20) |
offset |
number | No | Number of items to skip for pagination (default: 0) |
Headers
| Header | Value | Required |
|---|---|---|
Authorization |
Bearer <access_token> |
Yes |
Request
curl -X 'GET' \
'http://localhost:8080/api/v1/wishlists?page=1&limit=10' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9...'
Response
{
"data": [
{
"id": "5b24d429-c981-47c8-9318-f4d61dd2c1a4",
"name": "Polo T Shirt"
// ... product details
}
],
"metadata": {
"totalCount": 1,
"limit": 10,
"offset": 0
}
}
3. Check Product in Wishlist
GET
/api/v1/wishlists/check
| Parameter | Type | Required | Description |
|---|---|---|---|
productId |
string | Yes | UUID of the product to check |
Request
curl -X 'GET' \
'http://localhost:8080/api/v1/wishlists/check?productId=5b24d429-c981-47c8-9318-f4d61dd2c1a4' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <token>'
Response
4. Move Product to Cart
POST
/api/v1/wishlists/move-to-cart
| Parameter | Type | Required | Description |
|---|---|---|---|
productId |
string | Yes | UUID of the wishlist product to move |
quantity |
number | No | Quantity to add (default: 1) |
Request
curl -X 'POST' \
'http://localhost:8080/api/v1/wishlists/move-to-cart?productId=6c5078d3-f8e3-4c88-9afe-48b5423c664f&quantity=1' \
-H 'Authorization: Bearer <access_token>'
Returns the updated cart summary (201 Created).
5. Remove Product from Wishlist
DELETE
/api/v1/wishlists/remove
| Parameter | Type | Required | Description |
|---|---|---|---|
productId |
string | Yes | UUID of the product to remove from wishlist |
Headers
| Header | Value | Required |
|---|---|---|
Authorization |
Bearer <access_token> |
Yes |
Request
curl -X 'DELETE' \
'http://localhost:8080/api/v1/wishlists/remove?productId=5b24d429-c981-47c8-9318-f4d61dd2c1a4' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9...'
Response
6. List wishlisted product IDs
GET
/api/v1/wishlists/ids
curl -X 'GET' \
'http://localhost:8080/api/v1/wishlists/ids' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <access_token>'
Response
Error Handling
This API follows industry-standard error handling patterns (Stripe, GitHub, OpenAI):
Success Responses
- HTTP status code indicates success (200, 201, 204)
- Response body contains data directly (no wrapper object)
- No
isSuccessorstatusCodefields needed
Error Responses
Standard Error (400/401/403/404/500):
Validation Error (400):
{
"message": "Validation failed",
"errors": [
{"field": "email", "message": "Invalid email format"},
{"field": "password", "message": "Password must be at least 8 characters"}
]
}
Common Error Codes
| Status Code | Description | Example Message |
|---|---|---|
400 |
Bad Request | "Invalid email or password" |
401 |
Unauthorized | "Authentication required" |
403 |
Forbidden | "Insufficient permissions" |
404 |
Not Found | "Product not found" |
409 |
Conflict | "User already exists with this email" |
500 |
Internal Server Error | "Internal server error" |
All error messages are centralized and consistent across all endpoints.