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 顧客電子郵件 - *Customers will receive a requirement to reset password by email after creation. 使用open api Create Customer之後顧客將會收到要求重新設定密碼之email | "email":"[email protected]" |
mobile_phone *either email or mobile phone is required *email或mobile_phone二擇一 | String | Customer Mobile Phone 顧客手機 - *The '0' at the beginning of the phone number from TW was allowed to be skipped. 台灣電話號碼開首的'0'字可省略不輸入 | "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 顧客電話 - *Not verified phone number 請注意,非客戶手機驗證電話 | "phones": "0910123456, 02-27423586, +886912345678", |
gender | String | Customer's Gender 顧客性別 - Gender allows male 男性 female 女性 other 其他 | "gender":"male" |
birthday | Date | Customer's Birthday 顧客生日 - Minimum age restriction: The customer's birthday will be checked against the age limit based on admin setting. 將依據後台年齡限制檢查顧客生日 - Maximum age restriction: Birth years starting with 18xx-xx-xx will be considered an invalid birthday. 出生年份必須是西元 19 或20 開頭。西元 18 開頭的出生年份將被視為無效生日。 | "birthday":"2013-11-11" |
birth_year | Integer | Customer's birth year 顧客出生年份 *Could not be used with the birthday parameter at the same time. 不能與 birthday 參數同時使用 | "birth_year": 2000 |
birth_month | Integer | Customer's birth month 顧客出生月份 *Could not be used with the birthday parameter at the same time. 不能與 birthday 參數同時使用 | "birth_month": 11 |
birth_day | Integer | Customer's birth day 顧客出生日期 *Could not be used with the birthday parameter at the same time. 不能與 birthday 參數同時使用 | "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 顧客送貨地址 - *Maximum for 5 delivery address groups 最多五組 | "delivery_addresses":[{ "state": "Alabama", "city": "Taipei", "postcode": "10560", "address_1": "光復北路11巷44號14樓", "address_2": "松山區", "recipient_name": "marry", "recipient_phone": "0227423966", "recipient_phone_country_code": "886", "country": "TW" }] |
is_allow_welcome_credit | Boolean | Set as True for sending welcome credit. 是否發送入會購物金 *If welcome credit is enabled at admin panel, welcome credit and notification will be sent when creating customer. 若後台啟用入會購物金功能,建立顧客時會發送入會購物金與通知 Default: false | "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"
}
Updated 4 months ago