SendGrid Put 请求在应用程序代码中返回 400 响应

问题描述

我正在使用在 https://sendgrid.com/docs/api-reference/=> 生成代码 PUT /marketing/contacts 添加营销联系人。生成的.net 代码如下。我在我的应用程序中得到一个 Response status code does not indicate success: 400 (Bad Request).,但在 SendGrid 网站上同样有效。

我会遗漏什么?

var client = new RestClient("https://api.sendgrid.com/v3/marketing/contacts");
var request = new RestRequest(Method.PUT);
request.AddHeader("content-type","application/json");
request.AddHeader("authorization","Bearer <ClientId>");
request.AddParameter("application/json","{\"list_ids\":[\"bbb6445d-0d52-488e-ac38-55176369b9f4\"],\"contacts\":[{\"alternate_emails\":[\"ajitgoel@gmail.com\"],\"email\":\"ajitgoel@gmail.com\"}]}",ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)