在 Kustomer 中删除客户的电子邮件和 phone 号码
Remove email and phone number from customer in Kustomer
我在删除客户的电子邮件和 phone 密钥时遇到问题。
当我必须重新创建客户时,我收到一条错误消息,因为第一条记录具有相同的 phone 和电子邮件地址。我试着简单地从旧记录中删除它们,但它给了我一个 400 错误的请求。它说我需要指定一个电子邮件和 phone.
这不足为奇,尤其是因为 documentation 指定它们是必填字段。奇怪的是,我可以在没有电子邮件和 phone 的情况下创建客户。只是一旦拥有,我就无法摆脱。是否有一些解决方法可以让我重新创建客户?
当前从客户中删除电子邮件或 phone 号码的方法是使用您要保留的电子邮件更新客户对象。
例如,如果您有一个客户对象,如下所示:
{
"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
}
]
.....
}
我在删除客户的电子邮件和 phone 密钥时遇到问题。
当我必须重新创建客户时,我收到一条错误消息,因为第一条记录具有相同的 phone 和电子邮件地址。我试着简单地从旧记录中删除它们,但它给了我一个 400 错误的请求。它说我需要指定一个电子邮件和 phone.
这不足为奇,尤其是因为 documentation 指定它们是必填字段。奇怪的是,我可以在没有电子邮件和 phone 的情况下创建客户。只是一旦拥有,我就无法摆脱。是否有一些解决方法可以让我重新创建客户?
当前从客户中删除电子邮件或 phone 号码的方法是使用您要保留的电子邮件更新客户对象。
例如,如果您有一个客户对象,如下所示:
{
"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
}
]
.....
}