Create Price List
The POST endpoint creates a new price list with specified details.
Endpoint
- URL:
/priceList/create - Method:
POST
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Request Headers
| Header | Type | Description |
|---|---|---|
Content-Type | string | Must be application/json. |
accessToken | string | Access token for authentication. (required) |
Request Body
The request body should include the details of the price list to create. Below are the fields required:
| Field | Type | Description |
|---|---|---|
name | string | The name of the price list. |
status | boolean | The status of the price list (e.g., true). |
products | array | List of products and their details in the price list. |
Products Array:
Each item in the products array can include the following fields:
| Field | Type | Description |
|---|---|---|
product | string | The unique identifier of the product. |
variants | array | List of variant objects for the product. |
discount | number | Discount applied to the product. |
price | number | Base price of the product. |
tierPrice | array | List of tier pricing objects for the product. |
Variant Object:
| Field | Type | Description |
|---|---|---|
variantId | string | The unique identifier of the product variant. |
discount | number | Discount applied to the variant. |
price | number | Price of the variant. |
tierPrice | array | List of tier pricing objects for the variant. |
Tier Price Object:
| Field | Type | Description |
|---|---|---|
quantity | number | Minimum quantity for tier pricing. |
discount | number | Discount applied to this tier. |
price | number | Price at this tier. |
tierPricingType | string | Type of tier pricing (e.g., "discount", "fixed"). |
Sample Request Body
{
"name": "test price list update",
"status": true,
"products": [
{
"product": "66b4a01249e6ce3d41c428fa",
"variants": [
{
"variantId": "66d5a286fcb786834cebb167",
"discount": 10,
"price": 1120,
"tierPrice": [
{
"quantity": 4,
"discount": 4,
"price": 1150,
"tierPricingType": "discount"
}
]
},
{
"variantId": "66d5a286fcb786834cebb168",
"discount": 10,
"price": 1130,
"tierPrice": [
{
"quantity": 4,
"discount": 4,
"price": 1152,
"tierPricingType": "discount"
},
{
"quantity": 14,
"discount": 8,
"price": 1100,
"tierPricingType": "fixed"
}
]
}
],
"discount": 0,
"price": 1100,
"tierPrice": [
{
"quantity": 10,
"discount": 8,
"price": 1050,
"tierPricingType": "fixed"
}
]
}
]
}
Response
- Status Code: 200 OK
Sample Response Body
{
"success": true,
"message": "Price list created successfully",
"data": {
// Details of the created price list, e.g., ID, name, etc.
}
}
Success Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates the success status of the request, typically true for a successful operation. |
message | string | A message conveying the outcome of the operation, e.g., "Price list created successfully". |
data | object | Contains details of the newly created price list, defined in See Price list Data |
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request: Invalid input data. |
| 401 | Unauthorized: Access token is invalid or missing. |
| 500 | Internal Server Error: An error occurred on the server. |
Notes
- Ensure your request body is formatted according to the specified structure.
- Provide a valid and active access token in the request header to authenticate your request.