Create Customer
Function
To create a customer with open API
透過open API創建一筆新的顧客資料
URL
POST API_DOMAIN/v1/customers
Request Parameters
| Parameter | Value | Description | Example |
|---|---|---|---|
| name | String | Customer's Name 顧客姓名 | "name":"Marry" |
| email *either email or mobile_phone is required *email或mobile_phone二擇一 | String | Customer's Email 顧客電子郵件
| "email":"[email protected]" |
| mobile_phone *either email or mobile phone is required *email或mobile_phone二擇一 | String | Customer Mobile Phone 顧客手機
| "mobile_phone":"944384598" |
| mobile_phone_country_calling_code *required if mobile_phone is not empty | String | Country Code of Mobile Phone 手機號碼國碼 | "mobile_phone_country_calling_code":"886" |
| send_notification | Boolean | Will send welcome email/sms if True 是否發出歡迎電郵/短訊 -- Default: true -- 如果設定 false 就不會發送重設密碼通知 | "send_notification": false |
| phones | String | Customer's Phones 顧客電話
| "phones": "0910123456, 02-27423586, +886912345678", |
| gender | String | Customer's Gender 顧客性別
| "gender":"male" |
| birthday | Date | Customer's Birthday 顧客生日
| "birthday":"2013-11-11" |
| birth_year | Integer | Customer's birth year 顧客出生年份
| "birth_year": 2000 |
| birth_month | Integer | Customer's birth month 顧客出生月份
| "birth_month": 11 |
| birth_day | Integer | Customer's birth day 顧客出生日期
| "birth_day": 5 |
| is_member | Boolean | Set as True for registered customer 是否為會員? | "is_member":true |
| is_accept_marketing | Boolean | Set as True for acceptance of marketing news. [Note] | "is_accept_marketing":true |
| delivery_addresses | Array | Customer's Delivery Addresss 顧客送貨地址
| |
| is_allow_welcome_credit | Boolean | Set as True for sending welcome credit. 是否發送入會購物金
| "is_allow_welcome_credit":true |
| memo | String | Customer Memo 顧客備註 |
Request Example
Create a Customer.
curl -X POST \
API_DOMAIN/v1/customers \
-H 'Accept: application/json' \
-H 'Authorization: Bearar access_token' \
-H 'Content-Type: application/json' \
-H 'User-Agent: shopline' \
-d '{
"name": "marry",
"email": "[email protected]",
"mobile_phone": "944384598",
"mobile_phone_country_calling_code": "886",
"send_notification": false,
"phones": "0910123456, 02-27423586, +886912345678",
"gender": "male",
"birthday": "2013-11-11",
"is_member": true,
"is_accept_marketing": true,
"delivery_addresses":[{
"city": "Taipei",
"postcode": "10560",
"address_1": "光復北路11巷44號14樓",
"address_2": "松山區",
"recipient_name": "marry",
"recipient_phone": "0227423966",
"recipient_phone_country_code": "886",
"country": "TW"
}],
"created_by": "openapi"
}'curl -X POST \
https://open.shoplineapp.com/v1/customers \
-H 'Accept: application/json' \
-H 'Authorization: Bearar access_token' \
-H 'Content-Type: application/json' \
-H 'User-Agent: shopline' \
-d '{
"name": "marry",
"email": "[email protected]",
"phones": "0910123456, 02-27423586, +886912345678",
"gender": "male",
"birthday": "2013-11-11",
"is_member": true,
"is_accept_marketing": true,
"delivery_addresses":[{
"city": "Taipei",
"postcode": "10560",
"address_1": "光復北路11巷44號14樓",
"address_2": "松山區",
"recipient_name": "marry",
"recipient_phone": "0227423966",
"country": "TW"
},{
"city": "Taipei",
"postcode": "103",
"address_1": "中山北路二段12號10樓",
"address_2": "中山區",
"recipient_name": "marry",
"recipient_phone": "0227423966",
"country": "TW"
}]
}'Response Example
Also same with Get Customer
{
"id": "5b70f619003252000900000c",
"name": "marry",
"email": "[email protected]",
"gender": "male",
"birthday": "2013-11-05",
"birth_year": 2013,
"birth_month": 11,
"birth_day": 5,
"phones": [
"0910123456",
"02-27423586",
"+886912345678"
],
"phone": "0910000123",
"mobile_phone": "0944384598",
"mobile_phone_verified": false,
"mobile_phone_country_calling_code": "886",
"locale_code": null,
"orders_total_sum": 0,
"is_member": true,
"is_blacklisted": false,
"credit_balance": 0,
"custom_data": [],
"membership_tier": null,
"delivery_addresses": [
{
"city": "Taipei",
"postcode": "10560",
"address_1": "光復北路11巷44號14樓",
"address_2": "松山區",
"recipient_name": "marry",
"recipient_phone": "0227423966",
"recipient_phone_country_code": "886",
"country": "TW"
}
],
"subscribed_email_types": [
"marketing.news"
],
"ref_user_id": null,
"updated_at": "2018-08-13T03:08:09.285+00:00",
"created_at": "2018-08-13T03:08:09.167+00:00",
"current_sign_in_at": null,
"last_sign_in_at": null,
"created_by": "openapi"
}