以下接口请求如下:
curl --request GET \
--url https://api.sendgrid.com/v3/user/profile \
--header 'Authorization: Bearer API KEY'\
--header 'Content-Type: application/json'来自文档:https://sendgrid.com/docs/API_Reference/Web_API_v3/user.html
导致HTTP 403响应,正文如下:
{"errors":[{"field":null,"message":"access forbidden"}]}我转到设置->应用程序接口密钥,点击“编辑详细信息”查看授予我的应用程序接口密钥的权限,据我所知,我不能授予(或撤销)任何似乎与“用户配置文件”相关的权限。
为了安全起见,我已经将每个单独的权限配置为“完全访问”(当可用时)或“读取访问”,如果“完全访问”不可用,但我仍然收到此HTTP 403错误。
为了能够检索我的用户配置文件,我需要向我的API密钥授予什么权限?
发布于 2021-02-18 04:20:15
如果你像我一样,从节点库文档中获得了这里,正如Marius上面所说的,你的2021帐户将不能与节点客户端库中列出的旧api一起工作。使用node客户端,但使用此处的新api:https://sendgrid.api-docs.io/v3.0/contacts/add-or-update-a-contact
所以在2021年是可行的:
const client = require('@sendgrid/client');
client.setApiKey(sendgrid_api_key)
const uploadRequest = {
body: {
list_ids: [listId],
contacts: [
{
email: email,
first_name: firstName
}
]},
method: 'PUT',
url: '/v3/marketing/contacts'
}
const uploadResponse = await client.request(uploadRequest)对于大多数不一致的文档,Sendgrid可能会以这种速度夺得Paypal的桂冠:)
https://stackoverflow.com/questions/38613941
复制相似问题