我正在尝试在描述为here
的抑制列表中插入一个条目我已经尝试过这个,使用PHP代码,但我也使用自己的控制台在提供的网站上使用具有相同结果的有效API密钥获得相同的响应。
这是电话:
PUT https://api.sparkpost.com/api/v1/suppression-list/email@gmail.com
这是请求:
Content-Type: application/json
Authorization: XXXXXXXXXXXXX
Content-Length: 142
{
"transactional": false,
"non_transactional": true,
"description": "User requested to not receive any non-transactional emails."
}
这是我从服务器获得的响应:
connection: keep-alive
x-apiary-transaction-id: 5638e31d13b31d0700ae2b0a
cache-control: no-cache, no-store
content-type: application/json; charset=utf-8
date: Tue, 03 Nov 2015 16:38:54 GMT
server: msys-http
content-length: 45
x-newrelic-app-data: PxQDVFVRCQITVlZRDgcFV0YdFHYaFhEHQxFSERdoYWYcShNDHVEdUlIEG1FIVgsFBFxSVg8IG0RQBBQfQFdQVAFWWlsBXVdTUVcPURNNVQMIRVI8
via: 1.1 vegur
{
"errors": [
{
"message": "Method Not Allowed"
}
]
}
答案 0 :(得分:0)
当您将抑制列表添加到抑制列表时,您需要PUT
将它们添加到https://api.sparkpost.com/api/v1/suppression-list
,并且请求的正文必须如下所示:
{
"recipients": [
{
"email": "rcpt_1@example.com",
"transactional": true,
"description": "User requested to not receive any transactional emails."
},
{
"email": "rcpt_2@example.com",
"non_transactional": true
}
]
}
作为旁注,您应该确保以后不要在问题中发布Authorization
标题。那是你的API密钥 - 我建议删除该密钥并创建一个新密钥。