curl --request POST \
--url https://api.example.com/api/product/user/add \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"quantity": 123,
"category": "<string>",
"expiryDate": "<string>",
"notes": "<string>",
"isScannedProduct": true
}
'{
"message": "<string>",
"productId": "<string>",
"name": "<string>",
"quantity": 123,
"expiryDate": "<string>"
}Add a new product to the user’s inventory with optional barcode scanning
curl --request POST \
--url https://api.example.com/api/product/user/add \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"quantity": 123,
"category": "<string>",
"expiryDate": "<string>",
"notes": "<string>",
"isScannedProduct": true
}
'{
"message": "<string>",
"productId": "<string>",
"name": "<string>",
"quantity": 123,
"expiryDate": "<string>"
}barcode query parameter to automatically fetch product detailsuserId extracted from request.state.user.
barcode parameter provided): Sets expiry to 20 seconds from current time (for testing purposes)isScannedProduct: true): Calculates expiry based on product shelf life (fetched from product database)curl -X POST "https://api.expireeye.com/api/product/user/add?barcode=1234567890" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
curl -X POST "https://api.expireeye.com/api/product/user/add" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Organic Eggs",
"quantity": 2,
"category": "Dairy",
"notes": "Store in refrigerator",
"isScannedProduct": false
}'
curl -X POST "https://api.expireeye.com/api/product/user/add" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Fresh Bread",
"quantity": 1,
"category": "Bakery",
"isScannedProduct": true
}'
{
"detail": "Product not found for the provided barcode"
}
{
"detail": "User with the provided userId does not exist."
}
isScannedProduct: true, the system sends a real-time notification to the user with product details and nutrition information