Appearance
Create Existing Images Order
API Information
- Request Path:
/market/order/create - 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 | - |
| totalAmount | BigDecimal | Yes | Total order amount | - |
| thumb | String | No | Thumbnail URL | - |
ProductItemDto Structure
| 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 | - |
| discount | BigDecimal | No | Discount | - |
| discountAmount | BigDecimal | No | Discount Amount | - |
| discountUnitPrice | BigDecimal | No | Discount Unit Price | - |
Request Body Example
json
{
"products": [
{
"id": 1,
"provider": "changguang",
"productId": "product_123",
"unitPrice": 100.0,
"amount": 100.0,
"discount": 0.0,
"discountAmount": 0.0,
"discountUnitPrice": 100.0
}
],
"totalAmount": 100.00,
"thumb": "http://example.com/thumb.jpg"
}Response Body Structure
CommonResponse Object
| Field | Type | Description |
|---|---|---|
| code | Integer | Response status code |
| message | String | Response message |
| data | OrderCreateResp | Response data |
OrderCreateResp Object
| Field | Type | Description |
|---|---|---|
| orderNo | String | Created order number |
Response Examples
Success Response
json
{
"code": 200,
"message": "success",
"data": {
"orderNo": "ORDER_202310270001"
}
}Failure Response
json
{
"code": 400,
"message": "Invalid total amount",
"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 create a new order
- User authentication is required
- Provide list of products and total amount
Notes
- Total amount should match the sum of product prices