Update Price List
The PUT endpoint updates the details of an existing price list specified by priceList_id.
Endpoint
- URL:
/priceList/update/{priceList_id} - Method:
PUT
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Path Parameters
| Parameter | Type | Description |
|---|---|---|
priceList_id | string | The unique identifier of the price list to update. |
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 updated details for the price list. Below are the fields that can be updated:
| Field | Type | Description |
|---|---|---|
name | string | The updated name of the price list. |
status | boolean | The updated status of the price list. |
products | array | List of updated products 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 up",
"status": true,
"products": [
{
"product": "66b4a01249e6ce3d41c428fa",
"variants": [
{
"variantId": "66d5a286fcb786834cebb167",
"discount": 10,
"price": 120,
"tierPrice": [
{
"quantity": 4,
"discount": 4,
"price": 150,
"tierPricingType": "discount"
}
]
},
{
"variantId": "66d5a286fcb786834cebb168",
"discount": 10,
"price": 130,
"tierPrice": [
{
"quantity": 4,
"discount": 4,
"price": 152,
"tierPricingType": "discount"
},
{
"quantity": 14,
"discount": 8,
"price": 100,
"tierPricingType": "fixed"
}
]
}
],
"discount": 0,
"price": 100,
"tierPrice": [
{
"quantity": 10,
"discount": 8,
"price": 50,
"tierPricingType": "fixed"
}
]
},
{
"product": "665d9190894e45a4d2262293",
"discount": 0,
"price": 100,
"tierPrice": [
{
"quantity": 10,
"discount": 8,
"price": 150,
"tierPricingType": "fixed"
}
]
}
]
}
Response
- Status Code: 200 OK
Sample Response Body
{
"success": true,
"message": "Price list updated successfully",
"data": {
// Details of the updated 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 updated successfully". |
data | object | Contains details of the updated 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 you replace
{priceList_id}in the URL with the actual unique identifier of the price list being updated. - Provide a valid and active access token in the request header to authenticate your request.