Skip to main content

Update Quote

This PUT API allows you to update an existing quote with new details, including product quantities and requested prices.

Endpoint Details

  • URL: /quote/update/{quote_id}
  • Method: PUT
  • Authentication: Bearer Token (required)

Path Parameters

ParameterTypeDescription
quote_idstringThe unique identifier of the quote to update.

Authentication

You must provide a valid accessToken in the request headers to authenticate and access this endpoint.

Authentication Headers

HeaderTypeDescription
Content-TypestringMust be set to application/json.
accessTokenstringA valid access token is required.

Request Body

The request body should be in JSON format and must outline the updated details of the quote:

FieldTypeDescription
titlestringUpdated title of the quote.
companystringThe unique identifier of the company associated with the quote.
customerstringThe unique identifier of the customer for whom the quote is created.
statusstringUpdated status of the quote (e.g., "pending", "negotiated").
productsarrayArray of objects containing updated product details, including quantities and requested prices.
commentstringUpdated comments or notes for the quote.

Product Object (products[])

Each object in the products array should follow this structure:

FieldTypeDescription
productstringUnique identifier for the product.
variantstringUnique identifier for the product variant (optional).
quantitynumberUpdated quantity of the product or variant requested in the quote.
requestedPricestringUpdated price requested for the product or variant in the quote.

Sample Request Body

{
"title": "End of Season Quote",
"company": "65ba028af764f931f1c7c18b",
"customer": "66d07121db294e0b70180bf6",
"status": "negotiated",
"products": [
{
"product": "65b88ef5045a7d009e79974b",
"quantity": 5,
"requestedPrice": "1255"
},
{
"product": "66b4a01249e6ce3d41c428fa",
"variant": "66d5a286fcb786834cebb16a",
"quantity": 5,
"requestedPrice": "1967"
}
],
"comment": "Please review the updated terms."
}

Response

Success Response

Status CodeDescription
200 OKThe request was successful, and the quote details were updated.

Success Response Body Structure

FieldTypeDescription
successbooleanIndicates if the request was successful.
messagestringMessage indicating the result of the update.
dataobjectContains the updated details of the quote.

Sample Response Body

{
"success": true,
"message": "Quote updated Successfully",
"data": {
"id": "7323abc1648b4f3a8dfd7e23",
"title": "End of Season Quote",
"company": "65ba028af764f931f1c7c18b",
"customer": "66d07121db294e0b70180bf6",
"status": "negotiated",
"products": [
{
"product": "65b88ef5045a7d009e79974b",
"quantity": 5,
"requestedPrice": "1255"
},
{
"product": "66b4a01249e6ce3d41c428fa",
"variant": "66d5a286fcb786834cebb16a",
"quantity": 5,
"requestedPrice": "1967"
}
],
"comment": "Please review the updated terms.",
"createdAt": "2024-01-10T12:00:00Z",
"updatedAt": "2024-01-15T14:00:00Z"
}
}

Error Responses

Status CodeDescription
400 Bad RequestInvalid request format or missing data.
401 UnauthorizedInvalid or missing access token.
403 ForbiddenAccess denied.
404 Not FoundQuote not found.
500 Internal Server ErrorServer encountered an error.

Notes

  • Ensure that the quote_id in the URL matches the ID of the quote you wish to update.
  • Include all required fields in the request body to avoid validation errors.
  • A valid access token is necessary for authentication to successfully update the quote.