Tổng quan (tiếp)
Bắt đầu nhanh
Bước 3. Tạo một đơn dịch vụ thử
curl -i -X POST https://api-app.1stw.vn/api/v1/orders/services \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <tokenRequest>" \
-d '{
"O_Date": "2026-11-28T00:00:00",
"O_Customer_PartnerName": "Khách thử",
"O_Customer_Phone": "0900000001",
"O_Customer_Email": "khach@demo.vn",
"O_Customer_Address": "Hà Nội",
"O_TotalFinalMoney": 2200000,
"Services": [{
"ServiceName": "Nhóm dịch vụ", "ServiceClassName": "Gói A", "SupplierPartnerName": "NCC thử",
"I_Quantity": 2,
"I_UnitPriceCost": 800000, "I_PriceCost": 1600000, "I_PriceCostAfterVAT": 1600000,
"O_UnitPriceSale": 1000000, "O_PriceSale": 2000000,
"O_VATSalePercent": 10, "O_VATSaleMoney": 200000, "O_PriceSaleAfterVAT": 2200000
}]
}'const res = await fetch('https://api-app.1stw.vn/api/v1/orders/services', {
method: 'POST',
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${tokenRequest}` },
body: JSON.stringify(donHang), // cùng nội dung với body ở khối curl
});
const kq = await res.json(); // PascalCase: kq.Ok, kq.O_OrderCode, kq.OrderServiceId
if (res.status === 201 && kq.Ok) {
// Lưu kq.OrderServiceId (chuỗi Guid) để sửa đơn về sau
} else {
console.error(res.status, kq.Code, kq.Message);
}8stway.vn
