从Kustomer中删除客户的电子邮件和电话号码

时间:2017-01-24 15:31:31

标签: api crm kustomer

我无法从客户那里删除电子邮件和手机密钥。

当我必须重新创建客户时,我收到一条错误消息,因为第一条记录具有相同的电话和电子邮件地址。我试过简单地从旧记录中删除它们,但它给了我一个400坏请求。它说我需要指定一封电子邮件和电话。

这并不令人惊讶,特别是因为documentation指定它们是必填字段。奇怪的是,我可以在没有电子邮件和手机的情况下创建客户。只要他们拥有它们,我就无法摆脱它们。是否有一些解决方法可以让我重新创建客户?

1 个答案:

答案 0 :(得分:1)

目前从客户删除电子邮件或电话号码的方法是使用您要保留的电子邮件更新客户对象。

例如,如果您的客户对象如下所示:

{
  "data": {
    "type": "customer",
    "id": "58863fe94aa1701100efcb1d",
    "attributes": {
      "name": "Joe Cornelius Schmoe III",
      "displayName": "Joe Cornelius Schmoe III",
      "displayColor": "teal",
      "displayIcon": "broom",
      "externalId": "user-3",
      "externalIds": [
        {
          "externalId": "user-3",
          "verified": true
        }
      ],
      "firstName": "Joe",
      "lastName": "Schmoe",
      "sharedExternalIds": [],
      "emails": [
        {
          "email": "test@gmail.com",
          "verified": false,
          "type": "home"
        },
        {
          "email": "test2@gmail.com",
          "verified": false,
          "type": "home"
        }
      ],
      ....
}

如果您要删除与home相关联的电子邮件(对phones数组的工作方式相同。)

PUT / v1 / customers / {customerId}

{
    "emails": [
        {
          "email": "test@gmail.com",
          "verified": false,
          "type": "home"
        }
    ]
}

现在,客户记录将更新为仅包含指定的电子邮件。

{
  "data": {
    "type": "customer",
    "id": "58863fe94aa1701100efcb1d",
    "attributes": {
      "name": "Joe Cornelius Schmoe III",
      "displayName": "Joe Cornelius Schmoe III",
      "displayColor": "teal",
      "displayIcon": "broom",
      "externalId": "user-3",
      "externalIds": [
        {
          "externalId": "user-3",
          "verified": true,
          "id": null
        }
      ],
      "firstName": "Joe",
      "lastName": "Schmoe",
      "sharedExternalIds": [],
      "emails": [
        {
          "email": "test@gmail.com",
          "verified": false,
          "type": "home",
          "id": null
        }
      ]
      .....
}