gpt4 book ai didi

python - Mailjet:删除联系人

转载 作者:太空宇宙 更新时间:2023-11-04 09:45:01 25 4
gpt4 key购买 nike

是否可以从 mailjet实际删除 联系人

他们的 contact API doc甚至没有将 delete 列为受支持的操作。

from mailjet_rest import Client

mailjet = Client(auth=(MAILJET_API_KEY, MAILJET_API_SECRET), version='v3')
mailjet.contact.delete(<contact-id>).json()
{'ErrorInfo': '', 'ErrorMessage': 'Operation not allowed', 'StatusCode': 401}

我有兴趣删除联系人,而不是列表收件人,因此这个问题不是How can i delete a contact from a list with the mailjet api and php? 的重复问题.

最佳答案

API reference似乎还没有用 DELETE 方法更新,但在 API guides 下似乎有关于如何删除联系人的信息:

Retrieve a Contact

To delete a contact, you must first identify its presence in the contact database of your account.

Use GET /contact/$CONTACT_EMAIL to do it.

curl -s \
-X GET \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/contact/$CONTACT_EMAIL

Delete the Contact

Use the {contact_ID} you retrieved to DELETE the contact with the /v4/contacts/{contact_ID} endpoint. When the deletion is successful, the API will return a 200 OK status. Any other response will indicate that the deletion was not successfully processed.

curl -s \
-X DELETE \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v4/contacts/{contact_ID} \

注意:这是一个/v4 端点,而不是/v3

关于python - Mailjet:删除联系人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50170476/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com