c# - 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);
解决方案
推荐阅读
- tableau-api - 如何获取数据源的 SQL
- tensorflow - 来自 TF.Estimator 的 .pbtxt 的 freeze_graph MemoryError
- javascript - React-native expo 矢量图标未在 android 上显示
- javascript - HighMaps 仅在美国地图中显示最后一个系列的颜色
- python - 如何将 Python 数据框转换为列表列表?
- python - 导入说没有名为“可以”的模块,但库安装在站点包中?
- php - 我有一个简单的谱系数据库,想构造一个返回名称而不是 id 的查询
- docker-swarm - 在 docker service create 中,有没有办法指定用零(0)填充它的任务槽?
- javascript - 如何将一个常量从一个文件传递到另一个文件
- php - 如何使用 PHP 访问 ZohoBooks 中的数据