Man*_*oel 4 sendgrid sendgrid-api-v3 sendgrid-templates
我一直在尝试使用 API 检索 SendGrid 事务模板列表。我正在使用正确的 API 密钥并获得一个空数组,而我的 SendGrid 帐户中存在大约 5 个事务模板。这是回应:
{
"templates": []
}
Run Code Online (Sandbox Code Playgroud)
猜猜可能出了什么问题吗?
猜猜可能出了什么问题吗?
是的,他们的文档可能是!
我也一直困扰着这个问题,当我打开开发工具并看到他们如何从 UI 请求自己的 API 时,我终于成功解决了这个问题。长话短说——必须传递额外的generations=dynamic查询参数。这是我使用的 C# 代码:
var client = new SendGridClient("key");
var response = await client.RequestAsync(
SendGridClient.Method.GET,
urlPath: "/templates",
queryParams: "{\"generations\": \"dynamic\"}");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2666 次 |
| 最近记录: |