%= it.Breadcrumb(it.title, [ { label: "Home", href: "/" }, { label: "Import Data", href: "/import-data/lead" }, { label: "Customer", href: "/import-data/customer" }, { label: "คู่มือ API", current: true }, ]) %>
นำเข้าข้อมูลลูกค้า (B2B/B2C) ได้ 2 วิธี: อัปโหลดไฟล์ (CSV/XLSX) และ ส่งผ่าน API (JSON) — รองรับ type: individual (ชื่อคน) และ company (ชื่อบริษัท)
POST /api/v1/customers/import/file — Content-Type: multipart/form-data, Authorization: Bearer <JWT>
Form fields: file (ไฟล์), property_id
แถวแรก = Header. คอลัมน์: name (ชื่อคนหรือชื่อบริษัท), type (individual | company), email, phone, company, title, notes. แต่ละแถวต้องมี name หรือ email อย่างน้อย 1 ฟิลด์. ไม่ระบุ type = individual
POST /api/v1/customers/import — Content-Type: application/json
{
"property_id": "prop-001",
"customers": [
{ "name": "สมชาย ใจดี", "type": "individual", "email": "somchai@example.com", "phone": "0812345678", "company": "บริษัท ABC", "title": "ผู้จัดการ", "notes": "ลูกค้า B2C" },
{ "name": "บริษัท ดีไซน์โปร จำกัด", "type": "company", "email": "contact@designpro.co.th", "phone": "022345678", "notes": "ลูกค้า B2B" }
]
}
GET /api/v1/customers/import/example/csv — GET /api/v1/customers/import/example/xlsx (ต้องส่ง Authorization)