[英]SendInBlue API .NET6 Core Razor Pages in C# AddContactToList catching and throwing error
I a using the exact code here https://developers.sendinblue.com/reference/addcontacttolist-1 to add a user to a list.我在这里使用确切的代码https://developers.sendinblue.com/reference/addcontacttolist-1将用户添加到列表中。 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"}调用 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.他们的代码在 JSON 中显示了一个显示结果,它永远不会被命中,因为它在 Add 方法中抛出。
The error is straight-forward.错误是直截了当的。 The contact is already in the list and the API enforces uniqueness.该联系人已在列表中,API 强制唯一性。
You can get the contacts that are already in the list via getContactsFromList
您可以通过getContactsFromList
获取已在列表中的联系人
https://developers.sendinblue.com/reference/getcontactsfromlist https://developers.sendinblue.com/reference/getcontactsfromlist
or contact details via getContactInfo
:或通过getContactInfo
联系方式:
https://developers.sendinblue.com/reference/getcontactinfo-1https://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.否则,您可以毫无问题地添加它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.