C# AddContactToList 中的 SendInBlue API .NET6 Core Razor 页面捕获和抛出错误
调用 AddContactToList 时出错: {“code”:“invalid_parameter”,“message”:“联系人已在列表中和/或 不存在”}
他们的代码显示 JSON 格式的显示结果,该结果永远不会被命中,因为它会抛出 Add 方法。
I a using the exact code here https://developers.sendinblue.com/reference/addcontacttolist-1 to add a user to a list. It all works, user is created/updated (if exists) then the user is added to the list. However, when adding to the list it throws an error.
Error calling AddContactToList:
{"code":"invalid_parameter","message":"Contact already in list and/or
does not exist"}
Their code shows a display result in JSON which will never get hit because it throws at the Add method.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个错误很简单。该联系人已在列表中,并且 API 强制执行唯一性。
您可以通过
getContactsFromList
获取列表中已有的联系人https:// Developers.sendinblue.com/reference/getcontactsfromlist
或通过
getContactInfo
获取详细联系信息:https://developers.sendinblue.com/reference/getcontactinfo-1
因此,您需要检查联系人是否已在列表中。如果是这样,那么不要添加它。否则,您可以毫无问题地添加它。
The error is straight-forward. The contact is already in the list and the API enforces uniqueness.
You can get the contacts that are already in the list via
getContactsFromList
https://developers.sendinblue.com/reference/getcontactsfromlist
or contact details via
getContactInfo
:https://developers.sendinblue.com/reference/getcontactinfo-1
So, you will need to check whether the contact is already in the list. If so, then don't add it. Otherwise, you can add it without problems.