Appearance
Add Existing Images to Cart
API Information
- Request Path:
/market/shoppingCart/addProduct - Request Method:
POST - Content-Type:
application/json
Request Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
| Authorization | String | Yes | User authentication token |
| Content-Type | String | Yes | Must be set to application/json |
Request Body Structure
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| products | List<ProductItemDto> | Yes | List of products to add | - |
ProductItemDto Structure (Example)
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| id | Long | No | ID | - |
| provider | String | No | Provider | - |
| productId | String | Yes | Product ID | - |
| unitPrice | BigDecimal | No | Unit Price | - |
| amount | BigDecimal | No | Amount | - |
Request Body Example
json
{
"products": [
{
"amount": 15049.16,
"id": 86194,
"productId": "BC3_SM_ORG_2SSV_20230918T071722_001209_0004B9",
"provider": "tianyi",
"unitPrice": 21.6
}
]
}Response Body Structure
CommonResponse Object
| Field | Type | Description |
|---|---|---|
| code | Integer | Response status code |
| message | String | Response message |
| data | Integer | Response data |
Integer Object
| Field | Type | Description |
|---|---|---|
| value | Integer | Number of items added |
Response Examples
Success Response
json
{
"code": 200,
"message": "success",
"data": 1
}Failure Response
json
{
"code": 400,
"message": "Invalid product ID",
"data": null
}Error Code Description
| Error Code | Description |
|---|---|
| 200 | Success |
| 400 | Request parameter error |
| 401 | Unauthorized |
| 500 | Server internal error |
Usage Instructions
- This API is used to add products to the shopping cart
- User authentication is required
- Provide a list of product items with IDs and quantities
Notes
- Ensure product IDs are valid