HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

Update Customer

Function

To update information for a specific customer
更新顧客資料

URL

PUT <<api_domain>>/v1/customers/:id

Request parameters

ParameterTypeDescriptionExample
nameStringCustomer's name
顧客姓名
"name": "Shopline User"
mobile_phoneStringCustomer 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"
phonesString(to be deprecated, please use phone)
Customer's phones, separate by comma if multiple
顧客電話, 以逗号分隔
"phones": "123456,123456,123456"
phoneStringCustomer's phone
顧客電話
"phone": "0987123456"
phone_country_codeStringCountry Code of Customer's phone
顧客電話國碼
"phone_country_code": "886"
emailStringCustomer's email
顧客電子郵件
"email":"[email protected]"
genderStringCustomer's Gender
顧客性別
-
Gender allows
male 男性
female 女性
other 其他
"gender": "male"
birthdayDateCustomer's birthday
顧客生日

*Will check age limit based on admin setting
將依據後台年齡限制檢查顧客生日
"birthday": "2016-01-01"
birth_yearIntegerCustomer's birth year
顧客出生年份

*Could not be used with the birthday parameter at the same time.
不能與 birthday 參數同時使用
"birth_year": 2000
birth_monthIntegerCustomer's birth month
顧客出生月份

*Could not be used with the birthday parameter at the same time.
不能與 birthday 參數同時使用
"birth_month": 10
birth_dayIntegerCustomer's birth day
顧客出生日期

*Could not be used with the birthday parameter at the same time.
不能與 birthday 參數同時使用
"birth_day": 5
is_memberBooleanSet as registered customer
是否為會員

目前只支持將客戶轉成會員,不支援消息客戶會員。
"is_member": "true"
is_accept_marketingBooleanSet as True for acceptance of marketing news.
是否接受優惠宣傳?

[Note]
對應到前台顧客勾選 “訂閱電郵與簡訊”。

- 若店家透過 API 更動顧客「是否接受電郵宣傳」的選擇,需自行負擔相關法律責任。
"is_accept_marketing":true
is_blacklistedBooleanSet as blacklisted
是否設定在黑名單
"is_blacklisted": "true"
membership_tier_idStringMembership Tier ID
會員等級ID
-
Please check
Get Membership
Tiers
"membership_tier_id": "5af400e9e38809776100002f"
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", "recipient_phone_country_code": "886", "country": "TW" }]
ref_user_idStringUser ID from third party
第三方顧客ID
"ref_user_id": "SL001"
memoString備註"memo": "顧客備註"
tagsString顧客標籤"tags": "Tags A,Tags B"
custom_fieldsHashCustom field content
顧客客製化欄位
-
新增顧客自訂欄位請參考此篇後台操作說明

You can check Get CustomFields to get the custom_field_id, and parameter
可於 Get CustomFields 拿到客製化欄位的ID與參數
"custom_fields": {"5a72fdb0e388097fac000008": "test_value" }

Request Example

curl -X PUT \
  <<api_domain>>/v1/customers/5ae6978d69702d04ad000000 \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearar access_token' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Shopline User",
  "mobile_phone": "944384598",
  "mobile_phone_country_calling_code": "886",
  "phones": "02-27423586,0910000123",
  "gender": "male",
  "birthday": "2000-06-01",
  "memo": "memo by Grant",
  "tags": ["Tag A", "Tag C"],
  "is_member": "true",
  "is_blacklisted": "false",
  "membership_tier_id": "",
  "ref_user_id": "SL001",
  "custom_data": {
    "5a72fdb0e388097fac000008": "Test Value"
  }
}'

Response fields

The same as Get Customer

Response Example

The same as Get Customer

{
    "id": "606d4051c6febd0022d13447",
    "name": "Shopline User",
    "email": "[email protected]",
    "gender": "male",
    "birthday": "2000-06-01",
    "birth_year": 2000,
    "birth_month": 6,
    "birth_day": 1,
    "memo": "memo by Grant",
    "phones": [
        "02-27423586",
        "0910000123"
    ],
    "phone": "0910000123",
    "mobile_phone": "0944384598",
    "mobile_phone_verified": false,
    "mobile_phone_country_calling_code": "886",
    "locale_code": "zh-hant",
    "order_count": 0,
    "orders_total_sum": {
        "cents": 0,
        "currency_symbol": "NT$",
        "currency_iso": "TWD",
        "label": "",
        "dollars": 0.0
    },
    "is_member": true,
    "is_blacklisted": false,
    "is_subscribed_marketing_email": true,
    "credit_balance": 0,
    "member_point_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",
            "state": null,
            "key": null,
            "layer1": null,
            "layer2": null,
            "layer3": null,
            "district": null,
            "logistic_codes": null
        },
        {
            "city": "Taipei",
            "postcode": "10560",
            "address_1": "光復北路11巷44號14樓",
            "address_2": "松山區",
            "recipient_name": "marry",
            "recipient_phone": "0227423966",
            "country": "TW",
            "state": null,
            "key": null,
            "layer1": null,
            "layer2": null,
            "layer3": null,
            "district": null,
            "logistic_codes": null
        }
    ],
    "subscribed_email_types": [
        "marketing.news"
    ],
    "ref_user_id": "SL001",
    "line_id": null,
    "facebook_id": null,
    "updated_at": "2021-04-07T10:09:04.104+00:00",
    "created_at": "2021-04-07T05:17:05.406+00:00",
    "current_sign_in_at": null,
    "last_sign_in_at": null,
    "registered_at": "2021-04-07T05:17:05.368+00:00",
    "created_by": "mc",
    "tags": [
        "A",
        "C"
    ],
    "customer_authentication_linkings": [],
    "tier_expires_at": null
}