首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Amazon -无法使用Advertising API请求性能报告

Amazon -无法使用Advertising API请求性能报告
EN

Stack Overflow用户
提问于 2018-03-22 18:50:59
回答 3查看 1.2K关注 0票数 3

我在使用亚马逊广告API时遇到错误。我目前正在尝试使用https://advertising-api.amazon.com/v1/campaigns/report请求性能报告。但是服务器回复Cannot consume content type

这是我的请求头和请求体。

终点:https://advertising-api.amazon.com/v1/campaigns/report

方法类型:POST

标题:

代码语言:javascript
复制
{
     Authorization: 'Bearer xxxxxx',
     Amazon-Advertising-API-Scope: '11111111111',
     Content-Type: 'application/json'
}

正文:

代码语言:javascript
复制
{
    campaignType:'sponsoredProducts',
    reportDate:'20180320',
    metrics:'impressions,clicks'
}

我认为作为API文档我做的一切都是正确的,但是它说

{ "code": "415", "details": "Cannot consume content type" }

请帮帮我。

EN

回答 3

Stack Overflow用户

发布于 2018-11-06 14:38:52

试试这条路

代码语言:javascript
复制
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"
    }

您将得到如下的响应

代码语言:javascript
复制
{
  "reportId": "amzn1.clicksAPI.v1.p1.......",
  "recordType": "campaign",
  "status": "IN_PROGRESS",
  "statusDetails": "Report is being generated."
}

您也可以将此curl命令放入Postman中。

票数 1
EN

Stack Overflow用户

发布于 2018-12-18 13:07:41

我想你的身体可能缺了一个参数。当我成功地写了一篇类似的文章时,我需要我的身体至少有你写的东西以及片段类型。试着将这个添加到你的身体中:

代码语言:javascript
复制
{
campaignType:'sponsoredProducts',
reportDate:'20180320',
metrics:'impressions,clicks'
segment:'query'
}
票数 1
EN

Stack Overflow用户

发布于 2018-07-14 02:16:19

只需从文档中复制正文并将其粘贴到(postman的)原始区域,然后选择JSON格式。对我来说,它工作得很好。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49426761

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档