Chuyển tới nội dung chính

Thêm mới báo giá

1. Thông Tin API

  • Endpoint: /api/v6.1/quote
  • Method: POST
  • Authentication: Yêu cầu X-API-KEY
  • Header:
    • Content-Type: application/json
    • X-API-KEY: <your_api_key>

2. Request Body

{
"account_id": 1595,
"contact_id": 1758,
"quote_date": 1752033851,
"assigned_user": 1551,
"quote_number": 1,
"description": "Mô tả",
"project_name": "Dự án 1",
"project_address": "Hà Nội",
"note": "<p>Nội dung báo giá</p>",
"service_charge_after_vat": 0,
"transport": 10,
"transport_amount": 3000,
"discount": 10,
"discount_amount": 3300,
"after_vat": 0,
"vat": 10,
"vat_amount": 2970,
"installation": 10,
"installation_amount": 3300,
"installation_charge_after_discount": 0,
"end_date": 1752080400,
"custom_fields": {
"b1": "1234",
"b2": "3353"
},
"quote_details": [
{
"product_id": 279,
"description": "",
"quantity": 2,
"price": 15000,
"discount": 10,
"discount_amount": 1000,
"vat": 10,
"row_id": 1,
"items": [
{
"alias": "1.1",
"quantity": 1,
"price": 20000,
"vat": 0,
"discount": 0,
"discount_amount": 0,
"title": "SP101 - 1",
"row_id": 2,
"parent_row_id": 1,
"root_row_id": 1
}
],
"variants": [
{
"variant_attributes": [
{
"attribute_id": 1,
"attribute_value_id": 4
},
{
"attribute_id": 2,
"attribute_value_id": 8
}
]
}
]
}
]
}

3. Mô Tả Các Trường

3.1. Thông tin báo giá

TrườngLoạiBắt buộcMô tả
quote_codestringMã báo giá
account_idintegeryesĐịnh danh khách hàng
contact_idintegeryesId liên hệ khách hàng
quote_datetimestampyesNgày tạo báo giá
end_datetimestampNgày kết thúc
assigned_userintegerId người thực hiện
quote_numberintegerLần báo giá
descriptionstringMô tả
project_namestringTên dự án
project_addressstringĐịa chỉ dự án
notestringNội dung báo giá
custom_fieldsobjectĐịnh nghĩa dữ liệu

3.2. Thông tin tài chính

TrườngLoạiBắt buộcMô tả
after_vatenum (0,1)yesChiết khấu trước/sau thuế
discountnumericyesChiết khấu báo giá (%)
discount_amountnumericyesChiết khấu báo giá ($)
vatnumericyesVAT báo giá (%)
vat_amountnumericyesVAT báo giá ($)
service_charge_after_vatenum (0,1)yesPhí dịch vụ trước/sau thuế
transportnumericyesPhí vận chuyển (%)
transport_amountnumericyesPhí vận chuyển ($)
installation_charge_after_discountenum (0,1)yesPhí lắp đặt trước/sau thuế
installationnumericyesPhí lắp đặt (%)
installation_amountnumericyesPhí lắp đặt ($)

3.3. Danh sách sản phẩm (quote_details)

TrườngLoạiBắt buộcMô tả
quote_detailsarrayyesDanh sách sản phẩm
quote_details.*.product_idintegeryesĐịnh danh sản phẩm
quote_details.*.descriptionstringMô tả sản phẩm
quote_details.*.quantityintegeryesSố lượng sản phẩm
quote_details.*.pricenumericyesĐơn giá sản phẩm
quote_details.*.discountnumericyesChiết khấu sản phẩm (%)
quote_details.*.discount_amountnumericyesChiết khấu sản phẩm ($)
quote_details.*.vatnumericyesVAT sản phẩm (%)
quote_details.*.vat_amountnumericyesVAT sản phẩm ($)
quote_details.*.row_idintegeryesĐịnh danh để nối với phụ kiện
quote_details.*.itemsarrayDanh sách phụ kiện đi kèm
quote_details.*.variantsarrayBiến thể của sản phẩm (Bắt buộc nếu sản phẩm có biến thể)

3.4. Phụ kiện (quote_details.*.items)

TrườngLoạiBắt buộcMô tả
aliasstringAlias phụ kiện
titlestringTên phụ kiện
quantitynumericyesSố lượng phụ kiện
pricenumericyesĐơn giá phụ kiện
discountnumericyesChiết khấu phụ kiện (%)
discount_amountnumericyesChiết khấu phụ kiện ($)
vatnumericyesVAT phụ kiện (%)
row_idintegeryesĐịnh danh để nối với phụ kiện con
parent_row_idintegeryesĐịnh danh xác định phụ kiện cha
root_row_idintegeryesĐịnh danh xác định sản phẩm

4. Response

{
"message": "Thêm mới thành công",
"data": {
"id": 67,
"quote_code": "BG090720252"
}
}

5. Ghi Chú

  • quote_details bắt buộc phải có ít nhất một sản phẩm.
  • custom_fields chứa các trường tùy chỉnh, có thể lấy danh sách từ API custom fields.
  • Các giá trị ngày tháng (quote_date, end_date) truyền dưới dạng timestamp.
  • Nếu sản phẩm có biến thể, trường variants bắt buộc phải được truyền.