HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

Create Customer

Function

To create a customer with open API
透過open API創建一筆新的顧客資料

URL

POST <<api_domain>>/v1/customers

Request Parameters

ParameterValueDescriptionExample
name
*Required
StringCustomer's Name
顧客姓名
"name":"Marry"
email
*either email or mobile_phone is required
*email或mobile_phone二擇一
StringCustomer'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二擇一
StringCustomer 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
StringCountry Code of Mobile Phone
手機號碼國碼
"mobile_phone_country_calling_code":"886"
send_notificationBooleanWill send welcome email/sms if True
是否發出歡迎電郵/短訊
--
Default: true
"send_notification": false
phonesStringCustomer's Phones
顧客電話
-
*Not verified phone number
請注意,非客戶手機驗證電話
"phones": "0910123456, 02-27423586, +886912345678",
genderStringCustomer's Gender
顧客性別
-
Gender allows
male 男性
female 女性
other 其他
"gender":"male"
birthdayDateCustomer's Birthday
顧客生日

*Will check age limit based on admin setting
將依據後台年齡限制檢查顧客生日
"birthday":"2013-11-11"
is_memberBooleanSet as True for registered customer
是否為會員?
"is_member":true
is_accept_marketingBooleanSet as True for acceptance of marketing news.
是否接受優惠宣傳?
"is_accept_marketing":true
delivery_addressesArrayCustomer'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", "country": "TW" }]
is_allow_welcome_creditBooleanSet 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
registered_byStringRegistration source
會員註冊來源
---
shop
admin
openapi
shop_crm
pos
"registered_by":"shop"
memoStringCustomer 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",
    "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-11",
    "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",
            "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"
}