Skip to main content

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

ParameterTypeDescription
priceList_idstringThe unique identifier of the price list to update.

Request Headers

HeaderTypeDescription
Content-TypestringMust be application/json.
accessTokenstringAccess 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:

FieldTypeDescription
namestringThe updated name of the price list.
statusbooleanThe updated status of the price list.
productsarrayList of updated products in the price list.

Products Array:

Each item in the products array can include the following fields:

FieldTypeDescription
productstringThe unique identifier of the product.
variantsarrayList of variant objects for the product.
discountnumberDiscount applied to the product.
pricenumberBase price of the product.
tierPricearrayList of tier pricing objects for the product.

Variant Object:

FieldTypeDescription
variantIdstringThe unique identifier of the product variant.
discountnumberDiscount applied to the variant.
pricenumberPrice of the variant.
tierPricearrayList of tier pricing objects for the variant.

Tier Price Object:

FieldTypeDescription
quantitynumberMinimum quantity for tier pricing.
discountnumberDiscount applied to this tier.
pricenumberPrice at this tier.
tierPricingTypestringType 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

FieldTypeDescription
successbooleanIndicates the success status of the request, typically true for a successful operation.
messagestringA message conveying the outcome of the operation, e.g., "Price list updated successfully".
dataobjectContains details of the updated price list, defined in See Price list Data

Error Responses

Status CodeDescription
400Bad Request: Invalid input data.
401Unauthorized: Access token is invalid or missing.
500Internal 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.