【发布时间】:2022-09-23 08:32:16
【问题描述】:
有什么方法可以不受限制地从我的 API 密钥获取电子邮件活动?根据文档,限制参数不是必需的,但只要我不指定限制,我就会收到 BadRequest 响应。
public async Task<SentEmailModel> GetEmails()
{
var client = new SendGridClient(\"SENDGRID_API_KEY\");
var queryParams = @\"{
\'limit\': 100 //I dont\'t want to specify a limit, since I want to get the full list
}\";
var response = await client.RequestAsync(method: SendGridClient.Method.GET, urlPath: \"messages\", queryParams: queryParams);
if (response.IsSuccessStatusCode)
{
var responseString = response.Body.ReadAsStringAsync().Result;
var responseMessages = JsonConvert.DeserializeObject<SentEmailModel>(responseString);
return responseMessages;
}
return null;
}
-
The documentation 说限制是必需的.除了自己构建查询之外,我看不到任何明显的分页方式,尽管如果您同时发送大量电子邮件,这可能会很棘手。
标签: c# asp.net .net sendgrid sendgrid-api-v3