我在使用亚马逊广告API时遇到错误。我目前正在尝试使用https://advertising-api.amazon.com/v1/campaigns/report请求性能报告。但是服务器回复Cannot consume content type
这是我的请求头和请求体。
终点:https://advertising-api.amazon.com/v1/campaigns/report
方法类型:POST
标题:
{
Authorization: 'Bearer xxxxxx',
Amazon-Advertising-API-Scope: '11111111111',
Content-Type: 'application/json'
}正文:
{
campaignType:'sponsoredProducts',
reportDate:'20180320',
metrics:'impressions,clicks'
}我认为作为API文档我做的一切都是正确的,但是它说
{ "code": "415", "details": "Cannot consume content type" }
请帮帮我。

发布于 2018-11-06 14:38:52
试试这条路
curl -X POST \
https://advertising-api.amazon.com/v1/campaigns/report \
-H 'Amazon-Advertising-API-Scope: REPLACE_YOUR_PROFILE_ID' \
-H 'Authorization: REPLACE_YOUR_ACCESS_TOKEN' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-H 'Host: advertising-api.amazon.com' \
-H 'cache-control: no-cache' \
-d '{
"campaignType": "sponsoredProducts",
"metrics": "impressions,clicks",
"reportDate": "20181101"
}您将得到如下的响应
{
"reportId": "amzn1.clicksAPI.v1.p1.......",
"recordType": "campaign",
"status": "IN_PROGRESS",
"statusDetails": "Report is being generated."
}您也可以将此curl命令放入Postman中。
发布于 2018-12-18 13:07:41
我想你的身体可能缺了一个参数。当我成功地写了一篇类似的文章时,我需要我的身体至少有你写的东西以及片段类型。试着将这个添加到你的身体中:
{
campaignType:'sponsoredProducts',
reportDate:'20180320',
metrics:'impressions,clicks'
segment:'query'
}发布于 2018-07-14 02:16:19
只需从文档中复制正文并将其粘贴到(postman的)原始区域,然后选择JSON格式。对我来说,它工作得很好。
https://stackoverflow.com/questions/49426761
复制相似问题