Customer - 友好速搭 -- 开发文档

友好速搭

开放 API
使用说明 获取授权 全部 API 特殊 API 开放功能

Customer

Customer

#实体关系 Customer 是店铺中的顾客对象,可以通过 API 创建、获取顾客。

除了通过开放 API 来创建顾客外,还以通过用户数据接入来创建。

Customer 对象支持 WebhookMetafields

Customer 属性

    • created_at
    •   { "created_at" : "2014-09-01T00:00:01.987+08:0" }
      
      Datetime 类型,创建时间。
    • birthday
    •   { "birthday" : "2014-09-01T00:00:01.987+08:0" }
      
      Datetime 类型,创建时间。
    • id
    •   { "id" : 2 }
      
      Number 类型,唯一整型标识。
    • last_in
    •   { "last_in" : "2014-09-01T00:00:01.987+08:0" }
      
      Datetime 类型,最后一次登录时间。
    • name
    •   { "name" : "姓名" }
      
      String 类型,昵称,根据reg_type的不同,有以下情况:
      • reg_type=social:社交账号昵称
      • reg_type=email:邮箱@前半部分
      • reg_type=mobile:手机号码
      • reg_type=uname:用户名
    • notify_email
    •   { "notify_email" : "customer@sample.com" }
      
      String 类型,接收通知的邮箱。
    • notify_phone
    •   { "notify_phone" : "13632269632" }
      
      String 类型,接收通知的手机号码。
    • real_name
    •   { "real_name" : "张三" }
      
      String 类型,客户真实姓名。
    • identity_card
    •   { "identity_card" : "3622**********2933" }
      
      String 类型,真实18位身份证号码。
    • reg_identity
    •   { "reg_identity" : "customer@sample.com" }
      
      String 类型,唯一字符串标识,根据reg_type的不同,有以下情况:
      • reg_type=social:社交账号ID
      • reg_type=email:邮箱
      • reg_type=mobile:手机号码
      • reg_type=uname:用户名
    • reg_type
    •   { "reg_type" : "email" }
      
      String 类型,账号类型,包括:
      • social:社交账号注册
      • email:邮箱注册
      • mobile:手机注册
      • uname:用户名注册
    • updated_at
    •   { "updated_at": "2015-01-25T22:31:06.155+08:00" }
      
      Datetime 类型,最近一次修改时间。
    • customer_level_name
    •   { "customer_level_name" : "普通会员" }
      
      String 类型,账号的会员等级名。
    • total_credit
    •   { "total_credit" : 400 }
      
      Number 类型,账号的经验值。
    • trade_total_amount
    •   { "trade_total_amount" : 400 }
      
      Number 类型,账号的消费总额。
    • trade_total_count
    •   { "trade_total_count" : 1}
      
      Number 类型,账号的订单数。
    • reward_point
    •   { "reward_point" : 1}
      
      Number 类型,账号的积分。
    • last_year_reward_point
    •   { "last_year_reward_point" : 1}
      
      Number 类型,账号前一年的积分。
    • avatar
    •   { "avatar" : {
               "id": 6485,
               "asset_id": "57e542e45096de2e51000002",
               "file_name": "001.jpg",
               "epoch": "1474642762",
               "src": "/image/57e542e45096de2e51000002/001.jpg?1474642762"}
          }
      
      Hash 类型,账号的头像信息。

Customer 相关API

GET /customers获取店铺中所有 CustomerGET /customers/count获取店铺中 Customer 总数GET /customers/#{id}获取指定 ID 的 CustomerPOST /customers创建新的 CustomerPUT /customers/#{id}修改指定 ID 的 CustomerDELETE /customers/#{id}删除指定 ID 的 Customer。若指定账号已下单,则无法删除。PUT /customers/#{id}/adjust_reward_point修改指定 ID 的 Customer的积分。PUT /customers/#{id}/adjust_credit修改指定 ID 的 Customer的经验值。

GET /customers

获取店铺中所有 Customer

    • limit
    • 可选,返回结果条数
      默认10,最大50
    • page
    • 可选,显示的页码
      默认1
    • since_id
    • 可选,返回大于指定ID的结果
    • name
    • 可选,顾客昵称
    • reg_identity
    • 可选,顾客唯一标识
    • country_code
    • 可选,国家编码
    • country_name
    • 可选,国家名称
    • province_code
    • 可选,省份编码
    • province_name
    • 可选,省份名称
    • city_code
    • 可选,城市编码
    • city_name
    • 可选,城市名称
    • district_code
    • 可选,行政区编码
    • district_name
    • 可选,行政区名称
    • 获取店铺中所有 Customer 列表
    • GET /customers
    • {
      "customers": [
          {
              "addresses": [
                  {
                      "city": "市辖区",
                      "city_code": "110100",
                      "completed_address": "中国,北京市,市辖区,西城区,11111111111",
                      "country": "中国",
                      "country_code": "CN",
                      "created_at": "2014-12-07T11:09:07.067+08:00",
                      "detail": "11111111111",
                      "district": "西城区",
                      "district_code": "110102",
                      "email": "",
                      "id": 520,
                      "is_default": false,
                      "mobile": "13632269380",
                      "name": "11",
                      "province": "北京市",
                      "province_code": "110000",
                      "telephone": "",
                      "updated_at": "2014-12-07T11:09:07.067+08:00",
                      "zipcode": null
                  }
              ],
              "avatar": null,
              "created_at": "2014-11-26T00:26:43.896+08:00",
              "id": 595,
              "identity_card": "3622**********2933",
              "last_in": "2014-11-26T00:26:43.896+08:00",
              "name": "圣经-阿门",
              "notify_email": "",
              "notify_phone": "",
              "real_name": "张三",
              "reg_identity": "422C8EA0D0FC2755E1001320D82DAAF0",
              "reg_type": "social",
              "trade_total_amount": 50000, //单位:分
              "trade_total_count": 5,
              "updated_at": "2015-03-31T22:25:37.362+08:00",
              "customer_level_name": "普通会员",
              "total_credit": 400,
              "trade_total_amount": 400,
              "trade_total_count": 1,
              "birthday": null
          }
      ]
      }
      
    • 获取指定 ID 的 Customer
    • GET /customers?ids=595,596
    • {
      "customers": [
          {
              "addresses": [
                  {
                      "city": "市辖区",
                      "city_code": "110100",
                      "completed_address": "中国,北京市,市辖区,西城区,11111111111",
                      "country": "中国",
                      "country_code": "CN",
                      "created_at": "2014-12-07T11:09:07.067+08:00",
                      "detail": "11111111111",
                      "district": "西城区",
                      "district_code": "110102",
                      "email": "",
                      "id": 520,
                      "is_default": false,
                      "mobile": "13632269380",
                      "name": "11",
                      "province": "北京市",
                      "province_code": "110000",
                      "telephone": "",
                      "updated_at": "2014-12-07T11:09:07.067+08:00",
                      "zipcode": null
                  }
              ],
              "avatar": null,
              "created_at": "2014-11-26T00:26:43.896+08:00",
              "id": 595,
              "identity_card": "3622**********2933",
              "last_in": "2014-11-26T00:26:43.896+08:00",
              "name": "圣经-阿门",
              "notify_email": "",
              "notify_phone": "",
              "real_name": "张三",
              "reg_identity": "422C8EA0D0FC2755E1001320D82DAAF0",
              "reg_type": "social",
              "trade_total_amount": 50000, //单位:分
              "trade_total_count": 5,
              "updated_at": "2015-03-31T22:25:37.362+08:00",
              "customer_level_name": "普通会员",
              "reward_point": 10,
              "last_year_reward_point": 10,
              "birthday": null
          },
          {
              "addresses": [],
              "avatar": null,
              "created_at": "2014-11-26T00:28:37.573+08:00",
              "id": 596,
              "identity_card": "3622**********2933",
              "last_in": "2014-11-26T00:26:43.896+08:00",
              "name": "seem",
              "notify_email": "",
              "notify_phone": "",
              "real_name": "张三",
              "reg_identity": "A703FFB67275BD6AFF5E512775B15447",
              "reg_type": "social",
              "trade_total_amount": 50000, //单位:分
              "trade_total_count": 5,
              "updated_at": "2014-11-26T00:28:37.573+08:00",
              "customer_level_name": "普通会员",
              "total_credit": 400,
              "trade_total_amount": 400,
              "trade_total_count": 1,
              "reward_point": 10,
              "last_year_reward_point": 10,
              "birthday": null
          }
      ]
      }
      

GET /customers/count

获取店铺中 Customer 总数

    • 获取应用创建 Customer 总数
    • GET /customers/count
    • {
      "count": 160
      }
      

GET /customers/#{id}

获取指定 ID 的 Customer

    • 获取 ID 为 595 的 Customer
    • GET /customers/595
    • {
      "customer": {
          "addresses": [
              {
                  "city": "市辖区",
                  "city_code": "110100",
                  "completed_address": "中国,北京市,市辖区,西城区,11111111111",
                  "country": "中国",
                  "country_code": "CN",
                  "created_at": "2014-12-07T11:09:07.067+08:00",
                  "detail": "11111111111",
                  "district": "西城区",
                  "district_code": "110102",
                  "email": "",
                  "id": 520,
                  "is_default": false,
                  "mobile": "13632269380",
                  "name": "11",
                  "province": "北京市",
                  "province_code": "110000",
                  "telephone": "",
                  "updated_at": "2014-12-07T11:09:07.067+08:00",
                  "zipcode": null
              }
          ],
          "avatar": null,
          "created_at": "2014-11-26T00:26:43.896+08:00",
          "id": 595,
          "identity_card": "3622**********2933",
          "last_in": "2014-11-26T00:26:43.896+08:00",
          "name": "圣经-阿门",
          "notify_email": "",
          "notify_phone": "",
          "real_name": "张三",
          "reg_identity": "422C8EA0D0FC2755E1001320D82DAAF0",
          "reg_type": "social",
          "trade_total_amount": 50000, //单位:分
          "trade_total_count": 5,
          "updated_at": "2015-03-31T22:25:37.362+08:00",
          "customer_level_name": "普通会员",
          "reward_point": 10,
          "last_year_reward_point": 10,
          "birthday": null
      }
      }
      

POST /customers

创建新的 Customer

    • reg_type
    • 账号类型:
      1:邮箱注册
      2:手机号码注册
      3:用户名注册
    • reg_identity
    • 账号唯一标识:
      reg_type = 1:邮箱
      reg_type = 2:手机号码
      reg_type = 3:用户名
    • password
    • 账号密码,4-40个字符
    • notify_email
    • 接收通知的邮箱
    • notify_phone
    • 接收通知的手机号码
    • real_name
    • 客户真实姓名
    • identity_card
    • 18位身份证号码
    • avatar
    • 顾客头像信息:
      {"attachment": base64图片类型, "file_name": 文件名}
    • 创建 Customer
    • POST /customers
        {
          "customer": {
            "reg_type":"email",
            "reg_identity": "for@example.com",
            "password":"123456",
            "notify_email":"for@example.com",
            "notify_phone":"13632269380",
            "identity_card": "3622**********2933",
            "real_name": "张三",
            "birthday": "1990-01-01"
          }
        }
      
    • {
      "customer": {
          "addresses": [],
          "avatar": null,
          "created_at": "2014-11-26T00:26:43.896+08:00",
          "id": 4009,
          "identity_card": "3622**********2933",
          "last_in": "2014-11-26T00:26:43.896+08:00",
          "name": "wangzilong",
          "notify_email": "for@example.com",
          "notify_phone": "",
          "real_name": "张三",
          "reg_identity": "for@example.com",
          "reg_type": "email",
          "trade_total_amount": 0, //单位:分
          "trade_total_count": 0,
          "updated_at": "2015-04-28T20:20:22.747+08:00",
          "customer_level_name": "普通会员",
          "birthday": "1990-01-01T00:00:00.000+08:00",
      }
      }
      
    • 缺少reg_identity参数,创建 Customer 时会返回错误信息
    • POST /customer
        {
          "customer": {
            "reg_type":"email",   
            "password":"123456",
            "notify_email":"for@example.com",
            "notify_phone":"13632269380",
            "identity_card": "3622**********2933",
            "real_name": "张三"
          }
        }
      
    • {
      "code": 422,
      "errors": {
          "reg_identity": [
              "不可为空"
          ]
      }
      }
      

PUT /customers/#{id}

修改指定 ID 的 Customer

    • notify_email
    • 接收通知的邮箱
    • notify_phone
    • 接收通知的手机号码
    • real_name
    • 客户真实姓名
    • identity_card
    • 18位身份证号码
    • birthday
    • 生日
    • 修改id=4009对应账号的notify_email
    • PUT /customers/4009
        {
          "customer": {   
            "notify_email":"new@example.com",
            "notify_phone":"13632269381",
            "identity_card": "3622**********2933",
            "real_name": "张三",
            "birthday": "1990-01-01"
          }
        }
      
    • {
      "customer": {
          "addresses": [],
          "avatar": null,
          "created_at": "2014-11-26T00:26:43.896+08:00",
          "id": 4009,
          "identity_card": "3622**********2933",
          "last_in": "2014-11-26T00:26:43.896+08:00",
          "name": "wangzilong",
          "notify_email": "new@example.com",
          "notify_phone": "13632269381",
          "real_name": "张三"
          "reg_identity": "for@example.com",
          "reg_type": "email",
          "trade_total_amount": 0, //单位:分
          "trade_total_count": 0,
          "updated_at": "2015-04-28T21:08:14.067+08:00",
          "customer_level_name": "普通会员",
          "updated_at": "1990-01-01T00:00:00.000+08:00"
      }
      }
      

DELETE /customers/#{id}

删除指定 ID 的 Customer。若指定账号已下单,则无法删除。

    • 删除ID为4009的 Customer
    • DELETE /customers/4009
    • {}
      

PUT /customers/#{id}/adjust_reward_point

修改指定 ID 的 Customer的积分。

    • reward_point
    • 调整的积分数量
    • type
    • 调整类型:
      plus: 增加积分
      minus: 减少积分
    • admin_memo
    • 管理员备注
    • desc
    • 顾客看的经积分说明信息
    • 修改ID为4009的 Customer的积分
    • PUT/customers/4009/adjust_reward_point

      {
      "reward_point": 10,
      "type": "plus",
      "admin_memo": "赠送积分",
      "desc": "参与晒单活动,赠送积分"
      }
      
    • {}
      

PUT /customers/#{id}/adjust_credit

修改指定 ID 的 Customer的经验值。

    • credit
    • 调整的经验值
    • type
    • 调整类型:
      plus: 增加经验值
      minus: 减少经验值
    • admin_memo
    • 管理员备注
    • desc
    • 顾客看的经验值说明信息
    • 修改ID为4009的 Customer的经验值
    • PUT/customers/4009/adjust_credit

      {
      "credit": 10,
      "type": "plus",
      "admin_memo": "赠送经验值",
      "desc": "参与晒单活动,赠送经验值"
      }
      
    • {}
      
友好速搭与你一起,共赢未来
联系客服
电话咨询
服务热线
0755-83051027
获取报价
QQ咨询
微信咨询
微信二维码
在线咨询

在线获取方案和报价,专人快速响应

所选城市 *

您的称呼 *

联系电话 *

网站类型 *

请选择
展示官网 电商网站 微信商城 小程序 其他类型

您希望我们为您提供哪些服务?(可多选)

B2C商城 跨境解决方案 B2B2C平台电商 网站备案 自营电商培训
获取报价

提交成功

你好, XXX女士/先生 ,你的需求已提交成功,后续会有专门的客户经理与你电话联系。谢谢!