如何使用Mailjet API和PHP从列表中删除联系人? [英] How can i delete a contact from a list with the mailjet api and php?
问题描述
我使用mailjet api发送新闻稿,但我不知道如何从列表中删除联系人.
I use mailjet api to send newsletter, but i don't know how delete a contact from a list.
请帮助我.
推荐答案
我是Mailjet上的一名开发人员.
I'm a developer evangelist here at Mailjet.
contactlist
和contact
之间的关系通过listrecipient
实体表示.您可以在我们的指南中此处:
The relation between a contactlist
and a contact
is represented through the listrecipient
entity. You can learn more about this in our guide, here:
要从列表中删除联系人,您有两个选择:DELETE
此实体或从列表中取消订阅该联系人.第二种解决方案的优点是将联系人的状态保留在列表中.如果以后由于某种原因再次将其添加到列表中,它可以防止向联系人发送不需要的电子邮件.
To remove a contact from a list, you have two options: either DELETE
this entity or unsubscribe the contact from the list. The second solution has the advantage to keep the contact's status in the list. It prevents to send unwanted emails to a contact, if for some reason you add it in the list again later.
首先,执行GET
请求以检索listrecipient
实体的ID
.
如我们的参考文档所述,此处,使用联系人"和联系人列表"过滤器.
拥有ID
后,您可以在其上运行DELETE
请求以永久删除列表中的联系人,或者将IsUnsubscribed
属性设置为true
以取消订阅.
First, do a GET
request to retrieve the ID
of the listrecipient
entity.
As described in our reference documentation, here, use the Contact and ContactsList filter.
Once you have the ID
, you can either run a DELETE
request on it to permanently delete the contact in the list or set the IsUnsubscribed
property to true
to unsubscribe it.
这篇关于如何使用Mailjet API和PHP从列表中删除联系人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!