简体   繁体   English

SendInBlue API .NET6 Core Razor C# 中的页面 AddContactToList 捕获并抛出错误

[英]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.

相关问题 .NET CORE剃刀页面Ajax调用C#方法 - .NET CORE Razor Pages Ajax call to C# method 插入到 EF Core ASP.NET Core Razor Pages .NET6 中自动生成的 Bridge 表 - Insert to autogenerated Bridge table in EF Core ASP.NET Core Razor Pages .NET6 .net core 3 c# razor pages appsettings 值不可访问 - .net core 3 c# razor pages appsettings values not accessible asp.net 核心 razor 页面 C# 中的页面文件夹中使用 Partial.cshtml 文件的 CS7036 错误消息 - CS7036 error message using a Partial.cshtml file in a Pages folder in asp.net core razor pages C# 在ASP.NET Core中具有EF Core的Razor Pages-更新相关数据-使用c#的8之7 - Razor Pages with EF Core in ASP.NET Core - Update Related Data - 7 of 8 with c# 如何在 asp.net 核心 .NET6(Razor 页面)中的单个 cshtml 中显示来自多个表/模型的数据 - How to display data from multiple tables/models in a single cshtml in asp.net core .NET6 (Razor pages) 如何在项目targeting.Net6中使用VS2022查看Razor组件编译的c#代码? - How to see c# code compiled from Razor component with VS2022 in project targeting .Net6? 如何加载网站,然后在 Asp.Net Core (C#) Razor Pages 中添加数据 - How can I load the website and then later add data to it in Asp.Net Core (C#) Razor Pages Asp.Net Core 3.1 Cookies 未附加 Razor 页 C# - Asp.Net Core 3.1 Cookies not appended Razor Pages C# 从 JavaScript 传值到 C# ASP.NET 核心 Razor SQL 查询的页面 - Passing values from JavaScript to C# ASP.NET Core Razor Pages for SQL Querying
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM