cURL
basic
curl --request POST \ --url https://api.zangsho.com/v1/customers/batch \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data ' { "customers": [ { "email": "user1@example.com", "name": "User 1" }, { "email": "user2@example.com", "name": "User 2" } ] } '
{ "data": { "total": 50, "created": 45, "updated": 0, "skipped": 3, "failed": 2, "results": { "created": [ { "index": 0, "id": 123, "identifier": "user1@example.com" } ], "skipped": [ { "index": 5, "reason": "duplicate_email", "identifier": "existing@example.com" } ], "failed": [ { "index": 10, "reason": "validation_error", "message": "Invalid email format", "identifier": "invalid-email" } ] } } }
批次建立多位客戶,適合匯入歷史資料。
on_conflict
skip
update
使用 Laravel Sanctum Token 進行認證。
Token 可在商家後台的「API 設定」頁面取得。
1 - 100
Show child attributes
Email 衝突時的處理策略:
批次匯入結果